OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |