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

Side by Side Diff: chrome/browser/guest_view/extension_options/extension_options_guest.cc

Issue 426593007: Refactor guest view availability to be API not permission based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MostLikelyContextType Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/guest_view/extension_options/extension_options_guest.h" 5 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h" 9 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 18 matching lines...) Expand all
29 29
30 ExtensionOptionsGuest::ExtensionOptionsGuest( 30 ExtensionOptionsGuest::ExtensionOptionsGuest(
31 content::BrowserContext* browser_context, 31 content::BrowserContext* browser_context,
32 int guest_instance_id) 32 int guest_instance_id)
33 : GuestView<ExtensionOptionsGuest>(browser_context, guest_instance_id) { 33 : GuestView<ExtensionOptionsGuest>(browser_context, guest_instance_id) {
34 } 34 }
35 35
36 ExtensionOptionsGuest::~ExtensionOptionsGuest() { 36 ExtensionOptionsGuest::~ExtensionOptionsGuest() {
37 } 37 }
38 38
39 bool ExtensionOptionsGuest::CanEmbedderUseGuestView( 39 const char* ExtensionOptionsGuest::GetAPINamespace() {
40 const std::string& embedder_extension_id) { 40 return extensionoptions::kAPINamespace;
41 const extensions::Extension* embedder_extension =
42 extensions::ExtensionRegistry::Get(browser_context())
43 ->enabled_extensions()
44 .GetByID(embedder_extension_id);
45 if (!embedder_extension)
46 return false;
47 return embedder_extension->permissions_data()->HasAPIPermission(
48 extensions::APIPermission::kEmbeddedExtensionOptions);
49 } 41 }
50 42
51 // static 43 // static
52 GuestViewBase* ExtensionOptionsGuest::Create( 44 GuestViewBase* ExtensionOptionsGuest::Create(
53 content::BrowserContext* browser_context, 45 content::BrowserContext* browser_context,
54 int guest_instance_id) { 46 int guest_instance_id) {
55 if (!extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) { 47 if (!extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) {
56 return NULL; 48 return NULL;
57 } 49 }
58 return new ExtensionOptionsGuest(browser_context, guest_instance_id); 50 return new ExtensionOptionsGuest(browser_context, guest_instance_id);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 int min_width = 0; 168 int min_width = 0;
177 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, 169 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight,
178 &min_height); 170 &min_height);
179 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); 171 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width);
180 172
181 // Call SetAutoSize to apply all the appropriate validation and clipping of 173 // Call SetAutoSize to apply all the appropriate validation and clipping of
182 // values. 174 // values.
183 SetAutoSize( 175 SetAutoSize(
184 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); 176 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height));
185 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/extension_options/extension_options_guest.h ('k') | chrome/browser/guest_view/guest_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698