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 "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/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
10 #include "chrome/browser/guest_view/extension_options/extension_options_constant
s.h" | 10 #include "chrome/browser/guest_view/extension_options/extension_options_constant
s.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 12 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/extensions/api/extension_options_internal.h" | 17 #include "chrome/common/extensions/api/extension_options_internal.h" |
18 #include "chrome/common/extensions/manifest_url_handler.h" | |
19 #include "components/crx_file/id_util.h" | 18 #include "components/crx_file/id_util.h" |
20 #include "components/renderer_context_menu/context_menu_delegate.h" | 19 #include "components/renderer_context_menu/context_menu_delegate.h" |
21 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
22 #include "content/public/browser/site_instance.h" | 21 #include "content/public/browser/site_instance.h" |
23 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
24 #include "extensions/browser/extension_function_dispatcher.h" | 23 #include "extensions/browser/extension_function_dispatcher.h" |
25 #include "extensions/browser/extension_registry.h" | 24 #include "extensions/browser/extension_registry.h" |
26 #include "extensions/browser/guest_view/guest_view_manager.h" | 25 #include "extensions/browser/guest_view/guest_view_manager.h" |
27 #include "extensions/common/constants.h" | 26 #include "extensions/common/constants.h" |
28 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
29 #include "extensions/common/extension_messages.h" | 28 #include "extensions/common/extension_messages.h" |
30 #include "extensions/common/feature_switch.h" | 29 #include "extensions/common/feature_switch.h" |
| 30 #include "extensions/common/manifest_handlers/options_page_info.h" |
31 #include "extensions/common/permissions/permissions_data.h" | 31 #include "extensions/common/permissions/permissions_data.h" |
32 #include "extensions/strings/grit/extensions_strings.h" | 32 #include "extensions/strings/grit/extensions_strings.h" |
33 #include "ipc/ipc_message_macros.h" | 33 #include "ipc/ipc_message_macros.h" |
34 | 34 |
35 using content::WebContents; | 35 using content::WebContents; |
36 using namespace extensions::api; | 36 using namespace extensions::api; |
37 | 37 |
38 // static | 38 // static |
39 const char ExtensionOptionsGuest::Type[] = "extensionoptions"; | 39 const char ExtensionOptionsGuest::Type[] = "extensionoptions"; |
40 | 40 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (!extension_url.is_valid()) { | 83 if (!extension_url.is_valid()) { |
84 callback.Run(NULL); | 84 callback.Run(NULL); |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
88 // Get the options page URL for later use. | 88 // Get the options page URL for later use. |
89 extensions::ExtensionRegistry* registry = | 89 extensions::ExtensionRegistry* registry = |
90 extensions::ExtensionRegistry::Get(browser_context()); | 90 extensions::ExtensionRegistry::Get(browser_context()); |
91 const extensions::Extension* extension = | 91 const extensions::Extension* extension = |
92 registry->enabled_extensions().GetByID(extension_id); | 92 registry->enabled_extensions().GetByID(extension_id); |
93 options_page_ = extensions::ManifestURL::GetOptionsPage(extension); | 93 options_page_ = extensions::OptionsPageInfo::GetOptionsPage(extension); |
94 if (!options_page_.is_valid()) { | 94 if (!options_page_.is_valid()) { |
95 callback.Run(NULL); | 95 callback.Run(NULL); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 // Create a WebContents using the extension URL. The options page's | 99 // Create a WebContents using the extension URL. The options page's |
100 // WebContents should live in the same process as its parent extension's | 100 // WebContents should live in the same process as its parent extension's |
101 // WebContents, so we can use |extension_url| for creating the SiteInstance. | 101 // WebContents, so we can use |extension_url| for creating the SiteInstance. |
102 content::SiteInstance* options_site_instance = | 102 content::SiteInstance* options_site_instance = |
103 content::SiteInstance::CreateForURL(browser_context(), extension_url); | 103 content::SiteInstance::CreateForURL(browser_context(), extension_url); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 attach_params()->GetInteger(extensionoptions::kAttributeMinHeight, | 254 attach_params()->GetInteger(extensionoptions::kAttributeMinHeight, |
255 &min_height); | 255 &min_height); |
256 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 256 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
257 | 257 |
258 // Call SetAutoSize to apply all the appropriate validation and clipping of | 258 // Call SetAutoSize to apply all the appropriate validation and clipping of |
259 // values. | 259 // values. |
260 SetAutoSize(auto_size_enabled, | 260 SetAutoSize(auto_size_enabled, |
261 gfx::Size(min_width, min_height), | 261 gfx::Size(min_width, min_height), |
262 gfx::Size(max_width, max_height)); | 262 gfx::Size(max_width, max_height)); |
263 } | 263 } |
OLD | NEW |