Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 } | 58 } |
| 59 | 59 |
| 60 void ExtensionOptionsGuest::CreateWebContents( | 60 void ExtensionOptionsGuest::CreateWebContents( |
| 61 const std::string& embedder_extension_id, | 61 const std::string& embedder_extension_id, |
| 62 int embedder_render_process_id, | 62 int embedder_render_process_id, |
| 63 const base::DictionaryValue& create_params, | 63 const base::DictionaryValue& create_params, |
| 64 const WebContentsCreatedCallback& callback) { | 64 const WebContentsCreatedCallback& callback) { |
| 65 // Get the extension's base URL. | 65 // Get the extension's base URL. |
| 66 std::string extension_id; | 66 std::string extension_id; |
| 67 create_params.GetString(extensionoptions::kExtensionId, &extension_id); | 67 create_params.GetString(extensionoptions::kExtensionId, &extension_id); |
| 68 if (extension_id.empty()) { | 68 if (extension_id.empty()) { |
|
not at google - send to devlin
2014/07/30 17:33:10
this condition is actually covered by the one on l
ericzeng
2014/08/01 17:13:26
Removed.
| |
| 69 callback.Run(NULL); | 69 callback.Run(NULL); |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 DCHECK(extensions::Extension::IdIsValid(extension_id)); | 72 if (!extensions::Extension::IdIsValid(extension_id)) { |
| 73 callback.Run(NULL); | |
| 74 return; | |
| 75 } | |
| 76 | |
| 77 if (extension_id != embedder_extension_id) { | |
| 78 callback.Run(NULL); | |
| 79 return; | |
| 80 } | |
| 73 | 81 |
| 74 GURL extension_url = | 82 GURL extension_url = |
| 75 extensions::Extension::GetBaseURLFromExtensionId(extension_id); | 83 extensions::Extension::GetBaseURLFromExtensionId(extension_id); |
| 76 if (!extension_url.is_valid()) { | 84 if (!extension_url.is_valid()) { |
| 77 callback.Run(NULL); | 85 callback.Run(NULL); |
| 78 return; | 86 return; |
| 79 } | 87 } |
| 80 | 88 |
| 81 // Get the options page URL for later use. | 89 // Get the options page URL for later use. |
| 82 extensions::ExtensionRegistry* registry = | 90 extensions::ExtensionRegistry* registry = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 IPC_MESSAGE_UNHANDLED(handled = false) | 139 IPC_MESSAGE_UNHANDLED(handled = false) |
| 132 IPC_END_MESSAGE_MAP() | 140 IPC_END_MESSAGE_MAP() |
| 133 return handled; | 141 return handled; |
| 134 } | 142 } |
| 135 | 143 |
| 136 void ExtensionOptionsGuest::OnRequest( | 144 void ExtensionOptionsGuest::OnRequest( |
| 137 const ExtensionHostMsg_Request_Params& params) { | 145 const ExtensionHostMsg_Request_Params& params) { |
| 138 extension_function_dispatcher_->Dispatch( | 146 extension_function_dispatcher_->Dispatch( |
| 139 params, guest_web_contents()->GetRenderViewHost()); | 147 params, guest_web_contents()->GetRenderViewHost()); |
| 140 } | 148 } |
| OLD | NEW |