OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_split.h" | 10 #include "base/string_split.h" |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 bool has_prefs = pref_service_->Initialize(instance_, | 870 bool has_prefs = pref_service_->Initialize(instance_, |
871 automation_client_.get()); | 871 automation_client_.get()); |
872 if (has_prefs && pref_service_->GetProxyValueJSONString(&proxy_settings)) { | 872 if (has_prefs && pref_service_->GetProxyValueJSONString(&proxy_settings)) { |
873 automation_client_->SetProxySettings(proxy_settings); | 873 automation_client_->SetProxySettings(proxy_settings); |
874 } | 874 } |
875 | 875 |
876 if (navigate_after_initialization_ && !src_.empty()) { | 876 if (navigate_after_initialization_ && !src_.empty()) { |
877 navigate_after_initialization_ = false; | 877 navigate_after_initialization_ = false; |
878 if (!automation_client_->InitiateNavigation(src_, | 878 if (!automation_client_->InitiateNavigation(src_, |
879 GetDocumentUrl(), | 879 GetDocumentUrl(), |
880 is_privileged_)) { | 880 this)) { |
881 DLOG(ERROR) << "Failed to navigate to: " << src_; | 881 DLOG(ERROR) << "Failed to navigate to: " << src_; |
882 src_.clear(); | 882 src_.clear(); |
883 } | 883 } |
884 } | 884 } |
885 | 885 |
886 SetReadyState(READYSTATE_COMPLETE); | 886 SetReadyState(READYSTATE_COMPLETE); |
887 } | 887 } |
888 | 888 |
889 void ChromeFrameNPAPI::OnAutomationServerLaunchFailed( | 889 void ChromeFrameNPAPI::OnAutomationServerLaunchFailed( |
890 AutomationLaunchResult reason, const std::string& server_version) { | 890 AutomationLaunchResult reason, const std::string& server_version) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 } | 1161 } |
1162 } | 1162 } |
1163 | 1163 |
1164 std::string full_url = ResolveURL(GetDocumentUrl(), url); | 1164 std::string full_url = ResolveURL(GetDocumentUrl(), url); |
1165 | 1165 |
1166 src_ = full_url; | 1166 src_ = full_url; |
1167 // Navigate only if we completed initialization i.e. proxy is set etc. | 1167 // Navigate only if we completed initialization i.e. proxy is set etc. |
1168 if (ready_state_ == READYSTATE_COMPLETE) { | 1168 if (ready_state_ == READYSTATE_COMPLETE) { |
1169 if (!automation_client_->InitiateNavigation(full_url, | 1169 if (!automation_client_->InitiateNavigation(full_url, |
1170 GetDocumentUrl(), | 1170 GetDocumentUrl(), |
1171 is_privileged_)) { | 1171 this)) { |
1172 // TODO(tommi): call NPN_SetException. | 1172 // TODO(tommi): call NPN_SetException. |
1173 src_.clear(); | 1173 src_.clear(); |
1174 return false; | 1174 return false; |
1175 } | 1175 } |
1176 } else { | 1176 } else { |
1177 navigate_after_initialization_ = true; | 1177 navigate_after_initialization_ = true; |
1178 } | 1178 } |
1179 return true; | 1179 return true; |
1180 } | 1180 } |
1181 | 1181 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 } | 1505 } |
1506 | 1506 |
1507 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, | 1507 int32 ChromeFrameNPAPI::Write(NPStream* stream, int32 offset, int32 len, |
1508 void* buffer) { | 1508 void* buffer) { |
1509 return url_fetcher_.Write(stream, offset, len, buffer); | 1509 return url_fetcher_.Write(stream, offset, len, buffer); |
1510 } | 1510 } |
1511 | 1511 |
1512 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { | 1512 NPError ChromeFrameNPAPI::DestroyStream(NPStream* stream, NPReason reason) { |
1513 return url_fetcher_.DestroyStream(stream, reason); | 1513 return url_fetcher_.DestroyStream(stream, reason); |
1514 } | 1514 } |
OLD | NEW |