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/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" |
11 #include "chrome/common/extensions/api/extension_options_internal.h" | 11 #include "chrome/common/extensions/api/extension_options_internal.h" |
12 #include "chrome/common/extensions/manifest_url_handler.h" | 12 #include "chrome/common/extensions/manifest_url_handler.h" |
| 13 #include "components/crx_file/id_util.h" |
13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "extensions/browser/extension_function_dispatcher.h" | 17 #include "extensions/browser/extension_function_dispatcher.h" |
17 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
18 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
19 #include "extensions/common/extension_messages.h" | 20 #include "extensions/common/extension_messages.h" |
20 #include "extensions/common/feature_switch.h" | 21 #include "extensions/common/feature_switch.h" |
21 #include "extensions/common/permissions/permissions_data.h" | 22 #include "extensions/common/permissions/permissions_data.h" |
22 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
(...skipping 29 matching lines...) Expand all Loading... |
52 | 53 |
53 void ExtensionOptionsGuest::CreateWebContents( | 54 void ExtensionOptionsGuest::CreateWebContents( |
54 const std::string& embedder_extension_id, | 55 const std::string& embedder_extension_id, |
55 int embedder_render_process_id, | 56 int embedder_render_process_id, |
56 const base::DictionaryValue& create_params, | 57 const base::DictionaryValue& create_params, |
57 const WebContentsCreatedCallback& callback) { | 58 const WebContentsCreatedCallback& callback) { |
58 // Get the extension's base URL. | 59 // Get the extension's base URL. |
59 std::string extension_id; | 60 std::string extension_id; |
60 create_params.GetString(extensionoptions::kExtensionId, &extension_id); | 61 create_params.GetString(extensionoptions::kExtensionId, &extension_id); |
61 | 62 |
62 if (!extensions::Extension::IdIsValid(extension_id)) { | 63 if (!crx_file::id_util::IdIsValid(extension_id)) { |
63 callback.Run(NULL); | 64 callback.Run(NULL); |
64 return; | 65 return; |
65 } | 66 } |
66 | 67 |
67 if (extensions::Extension::IdIsValid(embedder_extension_id) && | 68 if (crx_file::id_util::IdIsValid(embedder_extension_id) && |
68 extension_id != embedder_extension_id) { | 69 extension_id != embedder_extension_id) { |
69 // Extensions cannot embed other extensions' options pages. | 70 // Extensions cannot embed other extensions' options pages. |
70 callback.Run(NULL); | 71 callback.Run(NULL); |
71 return; | 72 return; |
72 } | 73 } |
73 | 74 |
74 GURL extension_url = | 75 GURL extension_url = |
75 extensions::Extension::GetBaseURLFromExtensionId(extension_id); | 76 extensions::Extension::GetBaseURLFromExtensionId(extension_id); |
76 if (!extension_url.is_valid()) { | 77 if (!extension_url.is_valid()) { |
77 callback.Run(NULL); | 78 callback.Run(NULL); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 int min_width = 0; | 171 int min_width = 0; |
171 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, | 172 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, |
172 &min_height); | 173 &min_height); |
173 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 174 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
174 | 175 |
175 // Call SetAutoSize to apply all the appropriate validation and clipping of | 176 // Call SetAutoSize to apply all the appropriate validation and clipping of |
176 // values. | 177 // values. |
177 SetAutoSize( | 178 SetAutoSize( |
178 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); | 179 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); |
179 } | 180 } |
OLD | NEW |