OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 virtual void Respond(bool should_allow, | 190 virtual void Respond(bool should_allow, |
191 const std::string& user_input) OVERRIDE { | 191 const std::string& user_input) OVERRIDE { |
192 int embedder_render_process_id = | 192 int embedder_render_process_id = |
193 guest_->embedder_web_contents()->GetRenderProcessHost()->GetID(); | 193 guest_->embedder_web_contents()->GetRenderProcessHost()->GetID(); |
194 BrowserPluginGuest* guest = | 194 BrowserPluginGuest* guest = |
195 guest_->GetWebContents()->GetBrowserPluginGuestManager()-> | 195 guest_->GetWebContents()->GetBrowserPluginGuestManager()-> |
196 GetGuestByInstanceID(instance_id_, embedder_render_process_id); | 196 GetGuestByInstanceID(instance_id_, embedder_render_process_id); |
197 if (!guest) { | 197 if (!guest) { |
198 LOG(INFO) << "Guest not found. Instance ID: " << instance_id_; | 198 VLOG(0) << "Guest not found. Instance ID: " << instance_id_; |
199 return; | 199 return; |
200 } | 200 } |
201 | 201 |
202 // If we do not destroy the guest then we allow the new window. | 202 // If we do not destroy the guest then we allow the new window. |
203 if (!should_allow) | 203 if (!should_allow) |
204 guest->Destroy(); | 204 guest->Destroy(); |
205 } | 205 } |
206 | 206 |
207 private: | 207 private: |
208 virtual ~NewWindowRequest() {} | 208 virtual ~NewWindowRequest() {} |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 404 } |
405 web_contents->GetController().LoadURLWithParams(load_url_params); | 405 web_contents->GetController().LoadURLWithParams(load_url_params); |
406 } | 406 } |
407 | 407 |
408 void BrowserPluginGuest::RespondToPermissionRequest( | 408 void BrowserPluginGuest::RespondToPermissionRequest( |
409 int request_id, | 409 int request_id, |
410 bool should_allow, | 410 bool should_allow, |
411 const std::string& user_input) { | 411 const std::string& user_input) { |
412 RequestMap::iterator request_itr = permission_request_map_.find(request_id); | 412 RequestMap::iterator request_itr = permission_request_map_.find(request_id); |
413 if (request_itr == permission_request_map_.end()) { | 413 if (request_itr == permission_request_map_.end()) { |
414 LOG(INFO) << "Not a valid request ID."; | 414 VLOG(0) << "Not a valid request ID."; |
415 return; | 415 return; |
416 } | 416 } |
417 request_itr->second->Respond(should_allow, user_input); | 417 request_itr->second->Respond(should_allow, user_input); |
418 permission_request_map_.erase(request_itr); | 418 permission_request_map_.erase(request_itr); |
419 } | 419 } |
420 | 420 |
421 int BrowserPluginGuest::RequestPermission( | 421 int BrowserPluginGuest::RequestPermission( |
422 BrowserPluginPermissionType permission_type, | 422 BrowserPluginPermissionType permission_type, |
423 scoped_refptr<BrowserPluginGuest::PermissionRequest> request, | 423 scoped_refptr<BrowserPluginGuest::PermissionRequest> request, |
424 const base::DictionaryValue& request_info) { | 424 const base::DictionaryValue& request_info) { |
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 request_info.Set(browser_plugin::kRequestMethod, | 1741 request_info.Set(browser_plugin::kRequestMethod, |
1742 base::Value::CreateStringValue(request_method)); | 1742 base::Value::CreateStringValue(request_method)); |
1743 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1743 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1744 | 1744 |
1745 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1745 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
1746 new DownloadRequest(callback), | 1746 new DownloadRequest(callback), |
1747 request_info); | 1747 request_info); |
1748 } | 1748 } |
1749 | 1749 |
1750 } // namespace content | 1750 } // namespace content |
OLD | NEW |