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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void ExtensionOptionsGuest::CreateWebContents( | 61 void ExtensionOptionsGuest::CreateWebContents( |
62 const std::string& embedder_extension_id, | 62 const std::string& embedder_extension_id, |
63 int embedder_render_process_id, | 63 int embedder_render_process_id, |
64 const base::DictionaryValue& create_params, | 64 const base::DictionaryValue& create_params, |
65 const WebContentsCreatedCallback& callback) { | 65 const WebContentsCreatedCallback& callback) { |
66 // Get the extension's base URL. | 66 // Get the extension's base URL. |
67 std::string extension_id; | 67 std::string extension_id; |
68 create_params.GetString(extensionoptions::kExtensionId, &extension_id); | 68 create_params.GetString(extensionoptions::kExtensionId, &extension_id); |
69 if (extension_id.empty()) { | 69 |
| 70 if (!extensions::Extension::IdIsValid(extension_id)) { |
70 callback.Run(NULL); | 71 callback.Run(NULL); |
71 return; | 72 return; |
72 } | 73 } |
73 DCHECK(extensions::Extension::IdIsValid(extension_id)); | 74 |
| 75 if (extension_id != embedder_extension_id) { |
| 76 callback.Run(NULL); |
| 77 return; |
| 78 } |
74 | 79 |
75 GURL extension_url = | 80 GURL extension_url = |
76 extensions::Extension::GetBaseURLFromExtensionId(extension_id); | 81 extensions::Extension::GetBaseURLFromExtensionId(extension_id); |
77 if (!extension_url.is_valid()) { | 82 if (!extension_url.is_valid()) { |
78 callback.Run(NULL); | 83 callback.Run(NULL); |
79 return; | 84 return; |
80 } | 85 } |
81 | 86 |
82 // Get the options page URL for later use. | 87 // Get the options page URL for later use. |
83 extensions::ExtensionRegistry* registry = | 88 extensions::ExtensionRegistry* registry = |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 int min_width = 0; | 176 int min_width = 0; |
172 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, | 177 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, |
173 &min_height); | 178 &min_height); |
174 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 179 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
175 | 180 |
176 // Call SetAutoSize to apply all the appropriate validation and clipping of | 181 // Call SetAutoSize to apply all the appropriate validation and clipping of |
177 // values. | 182 // values. |
178 SetAutoSize( | 183 SetAutoSize( |
179 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); | 184 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); |
180 } | 185 } |
OLD | NEW |