Chromium Code Reviews| 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/bho.h" | 5 #include "chrome_frame/bho.h" |
| 6 | 6 |
| 7 #include <shlguid.h> | 7 #include <shlguid.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/win/scoped_bstr.h" | 14 #include "base/win/scoped_bstr.h" |
| 15 #include "chrome_tab.h" // NOLINT | 15 #include "chrome_tab.h" // NOLINT |
| 16 #include "chrome_frame/crash_reporting/crash_metrics.h" | 16 #include "chrome_frame/crash_reporting/crash_metrics.h" |
| 17 #include "chrome_frame/ready_prompt.h" | |
|
grt (UTC plus 2)
2010/11/10 17:59:29
Sort.
| |
| 17 #include "chrome_frame/extra_system_apis.h" | 18 #include "chrome_frame/extra_system_apis.h" |
| 18 #include "chrome_frame/http_negotiate.h" | 19 #include "chrome_frame/http_negotiate.h" |
| 19 #include "chrome_frame/metrics_service.h" | 20 #include "chrome_frame/metrics_service.h" |
| 20 #include "chrome_frame/protocol_sink_wrap.h" | 21 #include "chrome_frame/protocol_sink_wrap.h" |
| 21 #include "chrome_frame/urlmon_moniker.h" | 22 #include "chrome_frame/urlmon_moniker.h" |
| 22 #include "chrome_frame/utils.h" | 23 #include "chrome_frame/utils.h" |
| 23 #include "chrome_frame/vtable_patch_manager.h" | 24 #include "chrome_frame/vtable_patch_manager.h" |
| 24 | 25 |
| 25 static const int kIBrowserServiceOnHttpEquivIndex = 30; | 26 static const int kIBrowserServiceOnHttpEquivIndex = 30; |
| 26 | 27 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 } | 145 } |
| 145 | 146 |
| 146 STDMETHODIMP_(void) Bho::DocumentComplete(IDispatch* dispatch, VARIANT* url) { | 147 STDMETHODIMP_(void) Bho::DocumentComplete(IDispatch* dispatch, VARIANT* url) { |
| 147 DVLOG(1) << __FUNCTION__; | 148 DVLOG(1) << __FUNCTION__; |
| 148 | 149 |
| 149 ScopedComPtr<IWebBrowser2> web_browser2; | 150 ScopedComPtr<IWebBrowser2> web_browser2; |
| 150 if (dispatch) | 151 if (dispatch) |
| 151 web_browser2.QueryFrom(dispatch); | 152 web_browser2.QueryFrom(dispatch); |
| 152 | 153 |
| 153 if (web_browser2) { | 154 if (web_browser2) { |
| 155 if (infobar_manager_ == NULL) { | |
| 156 ScopedComPtr<IServiceProvider> service_provider; | |
|
amit
2010/11/12 00:04:49
Check for whether or not to show infobar is still
erikwright (departed)
2010/11/24 06:24:56
Yes. Now factored out into a separate CL.
| |
| 157 if (SUCCEEDED(service_provider.QueryFrom(web_browser2))) { | |
| 158 ScopedComPtr<IOleWindow> ole_window; | |
| 159 if (SUCCEEDED(service_provider->QueryService( | |
| 160 SID_SShellBrowser, IID_IOleWindow, (void**)ole_window.Receive()))) { | |
| 161 HWND web_browserhwnd = NULL; | |
| 162 if (SUCCEEDED(ole_window->GetWindow(&web_browserhwnd))) | |
| 163 infobar_manager_.reset(new InfobarManager(web_browserhwnd)); | |
| 164 } | |
| 165 } | |
| 166 } | |
| 167 if (infobar_manager_ != NULL) { | |
| 168 InfobarContent* content = new ReadyPromptContent(); | |
| 169 if(!SUCCEEDED(infobar_manager_->Show(content, TOP_INFOBAR, 38))) { | |
| 170 delete content; | |
|
grt (UTC plus 2)
2010/11/10 17:59:29
Making callers remember to delete the instance if
erikwright (departed)
2010/11/24 06:24:56
It now unequivocally takes ownership upon Show.
| |
| 171 } | |
| 172 } | |
|
grt (UTC plus 2)
2010/11/10 17:59:29
I see lots of checking for unexpected return codes
erikwright (departed)
2010/11/24 06:24:56
Yes. This is just a sample integration for now.
| |
| 173 | |
| 154 VARIANT_BOOL is_top_level = VARIANT_FALSE; | 174 VARIANT_BOOL is_top_level = VARIANT_FALSE; |
| 155 web_browser2->get_TopLevelContainer(&is_top_level); | 175 web_browser2->get_TopLevelContainer(&is_top_level); |
| 156 if (is_top_level) { | 176 if (is_top_level) { |
| 157 CrashMetricsReporter::GetInstance()->IncrementMetric( | 177 CrashMetricsReporter::GetInstance()->IncrementMetric( |
| 158 CrashMetricsReporter::NAVIGATION_COUNT); | 178 CrashMetricsReporter::NAVIGATION_COUNT); |
| 159 } | 179 } |
| 160 } | 180 } |
| 161 } | 181 } |
| 162 | 182 |
| 163 namespace { | 183 namespace { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 } else if (state_ == PATCH_IBROWSER) { | 375 } else if (state_ == PATCH_IBROWSER) { |
| 356 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); | 376 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); |
| 357 MonikerPatch::Uninitialize(); | 377 MonikerPatch::Uninitialize(); |
| 358 HttpNegotiatePatch::Uninitialize(); | 378 HttpNegotiatePatch::Uninitialize(); |
| 359 } else { | 379 } else { |
| 360 HttpNegotiatePatch::Uninitialize(); | 380 HttpNegotiatePatch::Uninitialize(); |
| 361 } | 381 } |
| 362 | 382 |
| 363 state_ = UNKNOWN; | 383 state_ = UNKNOWN; |
| 364 } | 384 } |
| OLD | NEW |