Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc

Issue 2570933002: Fix null dereference in ExtensionsGuestViewManagerDelegate. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h " 5 #include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h "
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "components/guest_view/browser/guest_view_base.h" 9 #include "components/guest_view/browser/guest_view_base.h"
10 #include "components/guest_view/browser/guest_view_manager.h" 10 #include "components/guest_view/browser/guest_view_manager.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // GetEventHistogramValue maps guest view event names to their histogram 50 // GetEventHistogramValue maps guest view event names to their histogram
51 // value. It needs to be like this because the guest view component doesn't 51 // value. It needs to be like this because the guest view component doesn't
52 // know about extensions, so GuestViewEvent can't have an 52 // know about extensions, so GuestViewEvent can't have an
53 // extensions::events::HistogramValue as an argument. 53 // extensions::events::HistogramValue as an argument.
54 events::HistogramValue histogram_value = 54 events::HistogramValue histogram_value =
55 guest_view_events::GetEventHistogramValue(event_name); 55 guest_view_events::GetEventHistogramValue(event_name);
56 DCHECK_NE(events::UNKNOWN, histogram_value) << "Event " << event_name 56 DCHECK_NE(events::UNKNOWN, histogram_value) << "Event " << event_name
57 << " must have a histogram value"; 57 << " must have a histogram value";
58 58
59 content::WebContents* owner = guest->owner_web_contents(); 59 content::WebContents* owner = guest->owner_web_contents();
60 if (!owner)
61 return; // Could happen at tab shutdown.
62
60 EventRouter::DispatchEventToSender(owner, guest->browser_context(), 63 EventRouter::DispatchEventToSender(owner, guest->browser_context(),
61 guest->owner_host(), histogram_value, 64 guest->owner_host(), histogram_value,
62 event_name, std::move(event_args), 65 event_name, std::move(event_args),
63 EventRouter::USER_GESTURE_UNKNOWN, info); 66 EventRouter::USER_GESTURE_UNKNOWN, info);
64 } 67 }
65 68
66 bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext( 69 bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext(
67 GuestViewBase* guest) { 70 GuestViewBase* guest) {
68 const Feature* feature = 71 const Feature* feature =
69 FeatureProvider::GetAPIFeature(guest->GetAPINamespace()); 72 FeatureProvider::GetAPIFeature(guest->GetAPINamespace());
(...skipping 26 matching lines...) Expand all
96 void ExtensionsGuestViewManagerDelegate::RegisterAdditionalGuestViewTypes() { 99 void ExtensionsGuestViewManagerDelegate::RegisterAdditionalGuestViewTypes() {
97 GuestViewManager* manager = GuestViewManager::FromBrowserContext(context_); 100 GuestViewManager* manager = GuestViewManager::FromBrowserContext(context_);
98 manager->RegisterGuestViewType<AppViewGuest>(); 101 manager->RegisterGuestViewType<AppViewGuest>();
99 manager->RegisterGuestViewType<ExtensionOptionsGuest>(); 102 manager->RegisterGuestViewType<ExtensionOptionsGuest>();
100 manager->RegisterGuestViewType<ExtensionViewGuest>(); 103 manager->RegisterGuestViewType<ExtensionViewGuest>();
101 manager->RegisterGuestViewType<MimeHandlerViewGuest>(); 104 manager->RegisterGuestViewType<MimeHandlerViewGuest>();
102 manager->RegisterGuestViewType<WebViewGuest>(); 105 manager->RegisterGuestViewType<WebViewGuest>();
103 } 106 }
104 107
105 } // namespace extensions 108 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698