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 // IE browser helper object implementation. | 5 // IE browser helper object implementation. |
6 #include "ceee/ie/plugin/bho/browser_helper_object.h" | 6 #include "ceee/ie/plugin/bho/browser_helper_object.h" |
7 | 7 |
8 #include <atlsafe.h> | 8 #include <atlsafe.h> |
9 #include <shlguid.h> | 9 #include <shlguid.h> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 BrowserHelperObject::BrowserHelperObject() | 95 BrowserHelperObject::BrowserHelperObject() |
96 : already_tried_installing_(false), | 96 : already_tried_installing_(false), |
97 tab_window_(NULL), | 97 tab_window_(NULL), |
98 tab_id_(kInvalidChromeSessionId), | 98 tab_id_(kInvalidChromeSessionId), |
99 fired_on_created_event_(false), | 99 fired_on_created_event_(false), |
100 lower_bound_ready_state_(READYSTATE_UNINITIALIZED), | 100 lower_bound_ready_state_(READYSTATE_UNINITIALIZED), |
101 ie7_or_later_(false), | 101 ie7_or_later_(false), |
102 thread_id_(::GetCurrentThreadId()), | 102 thread_id_(::GetCurrentThreadId()), |
103 full_tab_chrome_frame_(false), | 103 full_tab_chrome_frame_(false), |
104 broker_client_queue_(this), | 104 broker_client_queue_(this), |
105 broker_rpc_(false), | |
105 tab_events_funnel_(broker_client()) { | 106 tab_events_funnel_(broker_client()) { |
106 TRACE_EVENT_BEGIN("ceee.bho", this, ""); | 107 TRACE_EVENT_BEGIN("ceee.bho", this, ""); |
107 } | 108 } |
108 | 109 |
109 BrowserHelperObject::~BrowserHelperObject() { | 110 BrowserHelperObject::~BrowserHelperObject() { |
110 TRACE_EVENT_END("ceee.bho", this, ""); | 111 TRACE_EVENT_END("ceee.bho", this, ""); |
111 } | 112 } |
112 | 113 |
113 HRESULT BrowserHelperObject::FinalConstruct() { | 114 HRESULT BrowserHelperObject::FinalConstruct() { |
114 if (ceee_module_util::GetOptionToolbandIsHidden()) { | 115 if (ceee_module_util::GetOptionToolbandIsHidden()) { |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 port_id, message)); | 834 port_id, message)); |
834 VLOG(2) << "Deferred PostMessage(" << port_id << ", \"" << message << "\")"; | 835 VLOG(2) << "Deferred PostMessage(" << port_id << ", \"" << message << "\")"; |
835 return S_FALSE; | 836 return S_FALSE; |
836 } else { | 837 } else { |
837 return PostMessageImpl(port_id, message); | 838 return PostMessageImpl(port_id, message); |
838 } | 839 } |
839 } | 840 } |
840 | 841 |
841 HRESULT BrowserHelperObject::PostMessageImpl(int port_id, | 842 HRESULT BrowserHelperObject::PostMessageImpl(int port_id, |
842 const std::string& message) { | 843 const std::string& message) { |
843 return extension_port_manager_.PostMessage(port_id, message); | 844 return extension_port_manager_.PostMessage(port_id, message); |
844 } | 845 } |
845 | 846 |
846 HRESULT BrowserHelperObject::OnCfPrivateMessage(BSTR msg, | 847 HRESULT BrowserHelperObject::OnCfPrivateMessage(BSTR msg, |
847 BSTR origin, | 848 BSTR origin, |
848 BSTR target) { | 849 BSTR target) { |
849 const wchar_t* start = com::ToString(target); | 850 const wchar_t* start = com::ToString(target); |
850 const wchar_t* end = start + SysStringLen(target); | 851 const wchar_t* end = start + SysStringLen(target); |
851 if (LowerCaseEqualsASCII(start, end, ext::kAutomationPortRequestTarget) || | 852 if (LowerCaseEqualsASCII(start, end, ext::kAutomationPortRequestTarget) || |
852 LowerCaseEqualsASCII(start, end, ext::kAutomationPortResponseTarget)) { | 853 LowerCaseEqualsASCII(start, end, ext::kAutomationPortResponseTarget)) { |
853 extension_port_manager_.OnPortMessage(msg); | 854 extension_port_manager_.OnPortMessage(msg); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 if (V_VT(url) != VT_BSTR) { | 949 if (V_VT(url) != VT_BSTR) { |
949 LOG(ERROR) << "OnNavigateComplete2 url VT=" << V_VT(url); | 950 LOG(ERROR) << "OnNavigateComplete2 url VT=" << V_VT(url); |
950 return; | 951 return; |
951 } | 952 } |
952 | 953 |
953 mu::ScopedTimer metrics_timer("ceee/BHO.NavigateComplete", &broker_rpc()); | 954 mu::ScopedTimer metrics_timer("ceee/BHO.NavigateComplete", &broker_rpc()); |
954 base::win::ScopedBstr url_bstr(url->bstrVal); | 955 base::win::ScopedBstr url_bstr(url->bstrVal); |
955 HandleNavigateComplete(webbrowser, url_bstr); | 956 HandleNavigateComplete(webbrowser, url_bstr); |
956 | 957 |
957 for (std::vector<Sink*>::iterator iter = sinks_.begin(); | 958 for (std::vector<Sink*>::iterator iter = sinks_.begin(); |
958 iter != sinks_.end(); ++iter) { | 959 iter != sinks_.end(); ++iter) { |
959 (*iter)->OnNavigateComplete(webbrowser, url_bstr); | 960 (*iter)->OnNavigateComplete(webbrowser, url_bstr); |
Sigurður Ásgeirsson
2010/12/01 14:23:54
nit: indent -1
MAD
2010/12/01 16:35:23
Actually, -1 for "iter !=" and -2 for "(*iter)->"
Vitaly Buka corp
2010/12/01 19:06:04
That is strange. I didn't touch this code.
I'll fi
| |
960 } | 961 } |
961 } | 962 } |
962 | 963 |
963 STDMETHODIMP_(void) BrowserHelperObject::OnNavigateError( | 964 STDMETHODIMP_(void) BrowserHelperObject::OnNavigateError( |
964 IDispatch* webbrowser_disp, VARIANT* url, VARIANT* /*target_frame_name*/, | 965 IDispatch* webbrowser_disp, VARIANT* url, VARIANT* /*target_frame_name*/, |
965 VARIANT* status_code, VARIANT_BOOL* /*cancel*/) { | 966 VARIANT* status_code, VARIANT_BOOL* /*cancel*/) { |
966 if (webbrowser_disp == NULL || url == NULL || status_code == NULL) { | 967 if (webbrowser_disp == NULL || url == NULL || status_code == NULL) { |
967 LOG(ERROR) << "OnNavigateError got invalid parameter(s)"; | 968 LOG(ERROR) << "OnNavigateError got invalid parameter(s)"; |
968 return; | 969 return; |
969 } | 970 } |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1372 DCHECK(it->second != NULL); | 1373 DCHECK(it->second != NULL); |
1373 READYSTATE this_ready_state = it->second->GetReadyState(); | 1374 READYSTATE this_ready_state = it->second->GetReadyState(); |
1374 if (this_ready_state < new_lowest_ready_state) { | 1375 if (this_ready_state < new_lowest_ready_state) { |
1375 new_lowest_ready_state = this_ready_state; | 1376 new_lowest_ready_state = this_ready_state; |
1376 } | 1377 } |
1377 } | 1378 } |
1378 | 1379 |
1379 READYSTATE old_state = lower_bound_ready_state_; | 1380 READYSTATE old_state = lower_bound_ready_state_; |
1380 READYSTATE new_state = new_lowest_ready_state; | 1381 READYSTATE new_state = new_lowest_ready_state; |
1381 if (old_state == new_state) | 1382 if (old_state == new_state) |
1382 return S_OK; | 1383 return S_OK; |
Sigurður Ásgeirsson
2010/12/01 14:23:54
nit: indent +2
Vitaly Buka corp
2010/12/01 19:06:04
Same here.
On 2010/12/01 14:23:54, Ruðrugis wrote:
| |
1383 | 1384 |
1384 // Remember the new lowest ready state as our current one. | 1385 // Remember the new lowest ready state as our current one. |
1385 lower_bound_ready_state_ = new_state; | 1386 lower_bound_ready_state_ = new_state; |
1386 | 1387 |
1387 // Fire the event if the new ready state got us to or away from complete. | 1388 // Fire the event if the new ready state got us to or away from complete. |
1388 if (old_state == READYSTATE_COMPLETE || new_state == READYSTATE_COMPLETE) | 1389 if (old_state == READYSTATE_COMPLETE || new_state == READYSTATE_COMPLETE) |
1389 FireOnUpdatedEvent(NULL, new_state); | 1390 FireOnUpdatedEvent(NULL, new_state); |
1390 return S_OK; | 1391 return S_OK; |
1391 } | 1392 } |
1392 | 1393 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1587 return S_FALSE; | 1588 return S_FALSE; |
1588 } else { | 1589 } else { |
1589 return SendEventToBrokerImpl(event_name, event_args); | 1590 return SendEventToBrokerImpl(event_name, event_args); |
1590 } | 1591 } |
1591 } | 1592 } |
1592 | 1593 |
1593 HRESULT BrowserHelperObject::SendEventToBrokerImpl( | 1594 HRESULT BrowserHelperObject::SendEventToBrokerImpl( |
1594 const std::string& event_name, const std::string& event_args) { | 1595 const std::string& event_name, const std::string& event_args) { |
1595 return broker_rpc().FireEvent(event_name.c_str(), event_args.c_str()); | 1596 return broker_rpc().FireEvent(event_name.c_str(), event_args.c_str()); |
1596 } | 1597 } |
OLD | NEW |