| 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/extension.h" | 26 #include "extensions/common/extension.h" |
| 28 #include "extensions/common/extension_messages.h" | 27 #include "extensions/common/extension_messages.h" |
| 29 #include "extensions/common/feature_switch.h" | 28 #include "extensions/common/feature_switch.h" |
| 29 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 30 #include "extensions/common/permissions/permissions_data.h" | 30 #include "extensions/common/permissions/permissions_data.h" |
| 31 #include "extensions/strings/grit/extensions_strings.h" | 31 #include "extensions/strings/grit/extensions_strings.h" |
| 32 #include "ipc/ipc_message_macros.h" | 32 #include "ipc/ipc_message_macros.h" |
| 33 | 33 |
| 34 using content::WebContents; | 34 using content::WebContents; |
| 35 using namespace extensions::api; | 35 using namespace extensions::api; |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 const char ExtensionOptionsGuest::Type[] = "extensionoptions"; | 38 const char ExtensionOptionsGuest::Type[] = "extensionoptions"; |
| 39 | 39 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if (!extension_url.is_valid()) { | 82 if (!extension_url.is_valid()) { |
| 83 callback.Run(NULL); | 83 callback.Run(NULL); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Get the options page URL for later use. | 87 // Get the options page URL for later use. |
| 88 extensions::ExtensionRegistry* registry = | 88 extensions::ExtensionRegistry* registry = |
| 89 extensions::ExtensionRegistry::Get(browser_context()); | 89 extensions::ExtensionRegistry::Get(browser_context()); |
| 90 const extensions::Extension* extension = | 90 const extensions::Extension* extension = |
| 91 registry->enabled_extensions().GetByID(extension_id); | 91 registry->enabled_extensions().GetByID(extension_id); |
| 92 options_page_ = extensions::ManifestURL::GetOptionsPage(extension); | 92 options_page_ = extensions::OptionsPageInfo::GetOptionsPage(extension); |
| 93 if (!options_page_.is_valid()) { | 93 if (!options_page_.is_valid()) { |
| 94 callback.Run(NULL); | 94 callback.Run(NULL); |
| 95 return; | 95 return; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Create a WebContents using the extension URL. The options page's | 98 // Create a WebContents using the extension URL. The options page's |
| 99 // WebContents should live in the same process as its parent extension's | 99 // WebContents should live in the same process as its parent extension's |
| 100 // WebContents, so we can use |extension_url| for creating the SiteInstance. | 100 // WebContents, so we can use |extension_url| for creating the SiteInstance. |
| 101 content::SiteInstance* options_site_instance = | 101 content::SiteInstance* options_site_instance = |
| 102 content::SiteInstance::CreateForURL(browser_context(), extension_url); | 102 content::SiteInstance::CreateForURL(browser_context(), extension_url); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 attach_params()->GetInteger(extensionoptions::kAttributeMinHeight, | 231 attach_params()->GetInteger(extensionoptions::kAttributeMinHeight, |
| 232 &min_height); | 232 &min_height); |
| 233 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 233 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
| 234 | 234 |
| 235 // Call SetAutoSize to apply all the appropriate validation and clipping of | 235 // Call SetAutoSize to apply all the appropriate validation and clipping of |
| 236 // values. | 236 // values. |
| 237 SetAutoSize(auto_size_enabled, | 237 SetAutoSize(auto_size_enabled, |
| 238 gfx::Size(min_width, min_height), | 238 gfx::Size(min_width, min_height), |
| 239 gfx::Size(max_width, max_height)); | 239 gfx::Size(max_width, max_height)); |
| 240 } | 240 } |
| OLD | NEW |