OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_frame/chrome_frame_npapi.h" | 5 #include "chrome_frame/chrome_frame_npapi.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 Base::OnAutomationServerReady(); | 1034 Base::OnAutomationServerReady(); |
1035 | 1035 |
1036 std::string proxy_settings; | 1036 std::string proxy_settings; |
1037 bool has_prefs = pref_service_->Initialize(instance_, | 1037 bool has_prefs = pref_service_->Initialize(instance_, |
1038 automation_client_.get()); | 1038 automation_client_.get()); |
1039 if (has_prefs && pref_service_->GetProxyValueJSONString(&proxy_settings)) { | 1039 if (has_prefs && pref_service_->GetProxyValueJSONString(&proxy_settings)) { |
1040 automation_client_->SetProxySettings(proxy_settings); | 1040 automation_client_->SetProxySettings(proxy_settings); |
1041 } | 1041 } |
1042 | 1042 |
1043 if (!src_.empty()) { | 1043 if (!src_.empty()) { |
1044 if (!automation_client_->InitiateNavigation(src_, is_privileged_)) { | 1044 if (!automation_client_->InitiateNavigation(src_, |
| 1045 GetDocumentUrl(), |
| 1046 is_privileged_)) { |
1045 DLOG(ERROR) << "Failed to navigate to: " << src_; | 1047 DLOG(ERROR) << "Failed to navigate to: " << src_; |
1046 src_.clear(); | 1048 src_.clear(); |
1047 } | 1049 } |
1048 } | 1050 } |
1049 | 1051 |
1050 SetReadyState(READYSTATE_COMPLETE); | 1052 SetReadyState(READYSTATE_COMPLETE); |
1051 } | 1053 } |
1052 | 1054 |
1053 void ChromeFrameNPAPI::OnAutomationServerLaunchFailed( | 1055 void ChromeFrameNPAPI::OnAutomationServerLaunchFailed( |
1054 AutomationLaunchResult reason, const std::string& server_version) { | 1056 AutomationLaunchResult reason, const std::string& server_version) { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 } | 1304 } |
1303 } | 1305 } |
1304 DLOG(WARNING) << __FUNCTION__ << " " << url; | 1306 DLOG(WARNING) << __FUNCTION__ << " " << url; |
1305 std::string full_url = ResolveURL(GetDocumentUrl(), url); | 1307 std::string full_url = ResolveURL(GetDocumentUrl(), url); |
1306 if (full_url.empty()) | 1308 if (full_url.empty()) |
1307 return false; | 1309 return false; |
1308 | 1310 |
1309 src_ = full_url; | 1311 src_ = full_url; |
1310 // Navigate only if we completed initialization i.e. proxy is set etc. | 1312 // Navigate only if we completed initialization i.e. proxy is set etc. |
1311 if (ready_state_ == READYSTATE_COMPLETE) { | 1313 if (ready_state_ == READYSTATE_COMPLETE) { |
1312 if (!automation_client_->InitiateNavigation(full_url, is_privileged_)) { | 1314 if (!automation_client_->InitiateNavigation(full_url, |
| 1315 GetDocumentUrl(), |
| 1316 is_privileged_)) { |
1313 // TODO(tommi): call NPN_SetException. | 1317 // TODO(tommi): call NPN_SetException. |
1314 src_.clear(); | 1318 src_.clear(); |
1315 return false; | 1319 return false; |
1316 } | 1320 } |
1317 } | 1321 } |
1318 return true; | 1322 return true; |
1319 } | 1323 } |
1320 | 1324 |
1321 bool ChromeFrameNPAPI::postMessage(NPObject* npobject, const NPVariant* args, | 1325 bool ChromeFrameNPAPI::postMessage(NPObject* npobject, const NPVariant* args, |
1322 uint32_t arg_count, NPVariant* result) { | 1326 uint32_t arg_count, NPVariant* result) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 DCHECK(request ? automation_client_->IsValidRequest(request) : 1); | 1457 DCHECK(request ? automation_client_->IsValidRequest(request) : 1); |
1454 return request; | 1458 return request; |
1455 } | 1459 } |
1456 | 1460 |
1457 bool ChromeFrameNPAPI::HandleContextMenuCommand(UINT cmd) { | 1461 bool ChromeFrameNPAPI::HandleContextMenuCommand(UINT cmd) { |
1458 if (cmd == IDC_ABOUT_CHROME_FRAME) { | 1462 if (cmd == IDC_ABOUT_CHROME_FRAME) { |
1459 // TODO: implement "About Chrome Frame" | 1463 // TODO: implement "About Chrome Frame" |
1460 } | 1464 } |
1461 return false; | 1465 return false; |
1462 } | 1466 } |
OLD | NEW |