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

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

Issue 655143003: Don't try to create extensionoptions for extensions that don't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « chrome/test/data/extensions/webui/can_embed_extension_options.js ('k') | 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 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 "extensions/browser/guest_view/extension_options/extension_options_gues t.h" 5 #include "extensions/browser/guest_view/extension_options/extension_options_gues t.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "components/crx_file/id_util.h" 8 #include "components/crx_file/id_util.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/browser/site_instance.h" 10 #include "content/public/browser/site_instance.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (!extension_url.is_valid()) { 84 if (!extension_url.is_valid()) {
85 callback.Run(NULL); 85 callback.Run(NULL);
86 return; 86 return;
87 } 87 }
88 88
89 // Get the options page URL for later use. 89 // Get the options page URL for later use.
90 extensions::ExtensionRegistry* registry = 90 extensions::ExtensionRegistry* registry =
91 extensions::ExtensionRegistry::Get(browser_context()); 91 extensions::ExtensionRegistry::Get(browser_context());
92 const extensions::Extension* extension = 92 const extensions::Extension* extension =
93 registry->enabled_extensions().GetByID(extension_id); 93 registry->enabled_extensions().GetByID(extension_id);
94 if (!extension) {
95 // The ID was valid but the extension didn't exist. Typically this will
96 // happen when an extension is disabled.
97 callback.Run(NULL);
98 return;
99 }
100
94 options_page_ = extensions::OptionsPageInfo::GetOptionsPage(extension); 101 options_page_ = extensions::OptionsPageInfo::GetOptionsPage(extension);
95 if (!options_page_.is_valid()) { 102 if (!options_page_.is_valid()) {
96 callback.Run(NULL); 103 callback.Run(NULL);
97 return; 104 return;
98 } 105 }
99 106
100 // Create a WebContents using the extension URL. The options page's 107 // Create a WebContents using the extension URL. The options page's
101 // WebContents should live in the same process as its parent extension's 108 // WebContents should live in the same process as its parent extension's
102 // WebContents, so we can use |extension_url| for creating the SiteInstance. 109 // WebContents, so we can use |extension_url| for creating the SiteInstance.
103 content::SiteInstance* options_site_instance = 110 content::SiteInstance* options_site_instance =
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); 266 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width);
260 267
261 // Call SetAutoSize to apply all the appropriate validation and clipping of 268 // Call SetAutoSize to apply all the appropriate validation and clipping of
262 // values. 269 // values.
263 SetAutoSize(auto_size_enabled, 270 SetAutoSize(auto_size_enabled,
264 gfx::Size(min_width, min_height), 271 gfx::Size(min_width, min_height),
265 gfx::Size(max_width, max_height)); 272 gfx::Size(max_width, max_height));
266 } 273 }
267 274
268 } // namespace extensions 275 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/webui/can_embed_extension_options.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698