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

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

Issue 1835863002: Added check for behavior feature existense (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make Get*Feature return |nullptr| instead crash if feature is missing Created 4 years, 8 months 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 EventRouter::DispatchEventToSender(owner, guest->browser_context(), 60 EventRouter::DispatchEventToSender(owner, guest->browser_context(),
61 guest->owner_host(), histogram_value, 61 guest->owner_host(), histogram_value,
62 event_name, std::move(event_args), 62 event_name, std::move(event_args),
63 EventRouter::USER_GESTURE_UNKNOWN, info); 63 EventRouter::USER_GESTURE_UNKNOWN, info);
64 } 64 }
65 65
66 bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext( 66 bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext(
67 GuestViewBase* guest) { 67 GuestViewBase* guest) {
68 const Feature* feature = 68 const Feature* feature =
69 FeatureProvider::GetAPIFeature(guest->GetAPINamespace()); 69 FeatureProvider::GetAPIFeature(guest->GetAPINamespace());
70 CHECK(feature); 70 if (!feature)
71 return false;
71 72
72 ProcessMap* process_map = ProcessMap::Get(context_); 73 ProcessMap* process_map = ProcessMap::Get(context_);
73 CHECK(process_map); 74 CHECK(process_map);
74 75
75 const Extension* owner_extension = ProcessManager::Get(context_)-> 76 const Extension* owner_extension = ProcessManager::Get(context_)->
76 GetExtensionForWebContents(guest->owner_web_contents()); 77 GetExtensionForWebContents(guest->owner_web_contents());
77 78
78 // Ok for |owner_extension| to be nullptr, the embedder might be WebUI. 79 // Ok for |owner_extension| to be nullptr, the embedder might be WebUI.
79 Feature::Availability availability = feature->IsAvailableToContext( 80 Feature::Availability availability = feature->IsAvailableToContext(
80 owner_extension, 81 owner_extension,
(...skipping 14 matching lines...) Expand all
95 void ExtensionsGuestViewManagerDelegate::RegisterAdditionalGuestViewTypes() { 96 void ExtensionsGuestViewManagerDelegate::RegisterAdditionalGuestViewTypes() {
96 GuestViewManager* manager = GuestViewManager::FromBrowserContext(context_); 97 GuestViewManager* manager = GuestViewManager::FromBrowserContext(context_);
97 manager->RegisterGuestViewType<AppViewGuest>(); 98 manager->RegisterGuestViewType<AppViewGuest>();
98 manager->RegisterGuestViewType<ExtensionOptionsGuest>(); 99 manager->RegisterGuestViewType<ExtensionOptionsGuest>();
99 manager->RegisterGuestViewType<ExtensionViewGuest>(); 100 manager->RegisterGuestViewType<ExtensionViewGuest>();
100 manager->RegisterGuestViewType<MimeHandlerViewGuest>(); 101 manager->RegisterGuestViewType<MimeHandlerViewGuest>();
101 manager->RegisterGuestViewType<WebViewGuest>(); 102 manager->RegisterGuestViewType<WebViewGuest>();
102 } 103 }
103 104
104 } // namespace extensions 105 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_zoom_request_client.cc ('k') | extensions/common/features/feature_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698