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 // Implementation of ChromeActiveDocument | 5 // Implementation of ChromeActiveDocument |
6 #include "chrome_frame/chrome_active_document.h" | 6 #include "chrome_frame/chrome_active_document.h" |
7 | 7 |
8 #include <hlink.h> | 8 #include <hlink.h> |
9 #include <htiface.h> | 9 #include <htiface.h> |
10 #include <initguid.h> | 10 #include <initguid.h> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 mgr ? mgr->url(): std::wstring()); | 253 mgr ? mgr->url(): std::wstring()); |
254 } | 254 } |
255 | 255 |
256 ChromeFrameUrl cf_url; | 256 ChromeFrameUrl cf_url; |
257 if (!cf_url.Parse(url)) { | 257 if (!cf_url.Parse(url)) { |
258 DLOG(WARNING) << __FUNCTION__ << " Failed to parse url:" << url; | 258 DLOG(WARNING) << __FUNCTION__ << " Failed to parse url:" << url; |
259 return E_INVALIDARG; | 259 return E_INVALIDARG; |
260 } | 260 } |
261 | 261 |
262 std::string referrer(mgr ? mgr->referrer() : EmptyString()); | 262 std::string referrer(mgr ? mgr->referrer() : EmptyString()); |
| 263 RendererType renderer_type = cf_url.is_chrome_protocol() ? |
| 264 RENDERER_TYPE_CHROME_GCF_PROTOCOL : RENDERER_TYPE_UNDETERMINED; |
263 | 265 |
264 // With CTransaction patch we have more robust way to grab the referrer for | 266 // With CTransaction patch we have more robust way to grab the referrer for |
265 // each top-level-switch-to-CF request by peeking at our sniffing data | 267 // each top-level-switch-to-CF request by peeking at our sniffing data |
266 // object that lives inside the bind context. | 268 // object that lives inside the bind context. We also remember the reason |
| 269 // we're rendering the document in Chrome. |
267 if (g_patch_helper.state() == PatchHelper::PATCH_PROTOCOL && info) { | 270 if (g_patch_helper.state() == PatchHelper::PATCH_PROTOCOL && info) { |
268 scoped_refptr<ProtData> prot_data = info->get_prot_data(); | 271 scoped_refptr<ProtData> prot_data = info->get_prot_data(); |
269 if (prot_data) | 272 if (prot_data) { |
270 referrer = prot_data->referrer(); | 273 referrer = prot_data->referrer(); |
| 274 renderer_type = prot_data->renderer_type(); |
| 275 } |
271 } | 276 } |
272 | 277 |
273 // For gcf: URLs allow only about and view-source schemes to pass through for | 278 // For gcf: URLs allow only about and view-source schemes to pass through for |
274 // further inspection. | 279 // further inspection. |
275 bool is_safe_scheme = cf_url.gurl().SchemeIs(chrome::kAboutScheme) || | 280 bool is_safe_scheme = cf_url.gurl().SchemeIs(chrome::kAboutScheme) || |
276 cf_url.gurl().SchemeIs(chrome::kViewSourceScheme); | 281 cf_url.gurl().SchemeIs(chrome::kViewSourceScheme); |
277 if (cf_url.is_chrome_protocol() && !is_safe_scheme && | 282 if (cf_url.is_chrome_protocol() && !is_safe_scheme && |
278 !GetConfigBool(false, kAllowUnsafeURLs)) { | 283 !GetConfigBool(false, kAllowUnsafeURLs)) { |
279 DLOG(ERROR) << __FUNCTION__ << " gcf: not allowed:" << url; | 284 DLOG(ERROR) << __FUNCTION__ << " gcf: not allowed:" << url; |
280 return E_INVALIDARG; | 285 return E_INVALIDARG; |
281 } | 286 } |
282 | 287 |
283 if (!LaunchUrl(cf_url, referrer)) { | 288 if (!LaunchUrl(cf_url, referrer)) { |
284 DLOG(ERROR) << __FUNCTION__ << " Failed to launch url:" << url; | 289 DLOG(ERROR) << __FUNCTION__ << " Failed to launch url:" << url; |
285 return E_INVALIDARG; | 290 return E_INVALIDARG; |
286 } | 291 } |
287 | 292 |
288 if (!cf_url.is_chrome_protocol() && !cf_url.attach_to_external_tab()) | 293 if (!cf_url.is_chrome_protocol() && !cf_url.attach_to_external_tab()) |
289 url_fetcher_->SetInfoForUrl(url.c_str(), moniker_name, bind_context); | 294 url_fetcher_->SetInfoForUrl(url.c_str(), moniker_name, bind_context); |
290 | 295 |
291 THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.FullTabLaunchType", | 296 // Log a metric indicating why GCF is rendering in Chrome. |
292 cf_url.is_chrome_protocol(), | 297 // (Note: we only track the renderer type when using the CTransaction patch. |
293 0, 1, 2); | 298 // When the code for the browser service patch and for the moniker patch is |
| 299 // removed, this conditional can also go away.) |
| 300 if (RENDERER_TYPE_UNDETERMINED != renderer_type) { |
| 301 THREAD_SAFE_UMA_LAUNCH_TYPE_COUNT(renderer_type); |
| 302 } |
| 303 |
294 return S_OK; | 304 return S_OK; |
295 } | 305 } |
296 | 306 |
297 STDMETHODIMP ChromeActiveDocument::Save(IMoniker* moniker_name, | 307 STDMETHODIMP ChromeActiveDocument::Save(IMoniker* moniker_name, |
298 LPBC bind_context, | 308 LPBC bind_context, |
299 BOOL remember) { | 309 BOOL remember) { |
300 return E_NOTIMPL; | 310 return E_NOTIMPL; |
301 } | 311 } |
302 | 312 |
303 STDMETHODIMP ChromeActiveDocument::SaveCompleted(IMoniker* moniker_name, | 313 STDMETHODIMP ChromeActiveDocument::SaveCompleted(IMoniker* moniker_name, |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 web_browser2->put_Height(dimensions_.height()); | 1297 web_browser2->put_Height(dimensions_.height()); |
1288 web_browser2->put_Left(dimensions_.x()); | 1298 web_browser2->put_Left(dimensions_.x()); |
1289 web_browser2->put_Top(dimensions_.y()); | 1299 web_browser2->put_Top(dimensions_.y()); |
1290 web_browser2->put_MenuBar(VARIANT_FALSE); | 1300 web_browser2->put_MenuBar(VARIANT_FALSE); |
1291 web_browser2->put_ToolBar(VARIANT_FALSE); | 1301 web_browser2->put_ToolBar(VARIANT_FALSE); |
1292 | 1302 |
1293 dimensions_.set_height(0); | 1303 dimensions_.set_height(0); |
1294 dimensions_.set_width(0); | 1304 dimensions_.set_width(0); |
1295 } | 1305 } |
1296 } | 1306 } |
OLD | NEW |