Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move to content namespace. Update usages. Update extract_actions tool. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 19 matching lines...) Expand all
30 #include "content/browser/renderer_host/resource_request_details.h" 30 #include "content/browser/renderer_host/resource_request_details.h"
31 #include "content/browser/site_instance.h" 31 #include "content/browser/site_instance.h"
32 #include "content/browser/tab_contents/interstitial_page.h" 32 #include "content/browser/tab_contents/interstitial_page.h"
33 #include "content/browser/tab_contents/navigation_details.h" 33 #include "content/browser/tab_contents/navigation_details.h"
34 #include "content/browser/tab_contents/navigation_entry.h" 34 #include "content/browser/tab_contents/navigation_entry.h"
35 #include "content/browser/tab_contents/provisional_load_details.h" 35 #include "content/browser/tab_contents/provisional_load_details.h"
36 #include "content/browser/tab_contents/tab_contents_delegate.h" 36 #include "content/browser/tab_contents/tab_contents_delegate.h"
37 #include "content/browser/tab_contents/tab_contents_observer.h" 37 #include "content/browser/tab_contents/tab_contents_observer.h"
38 #include "content/browser/tab_contents/tab_contents_view.h" 38 #include "content/browser/tab_contents/tab_contents_view.h"
39 #include "content/browser/tab_contents/title_updated_details.h" 39 #include "content/browser/tab_contents/title_updated_details.h"
40 #include "content/browser/user_metrics.h"
41 #include "content/browser/webui/web_ui_factory.h" 40 #include "content/browser/webui/web_ui_factory.h"
42 #include "content/common/intents_messages.h" 41 #include "content/common/intents_messages.h"
43 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
44 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
45 #include "content/public/browser/devtools_agent_host_registry.h" 44 #include "content/public/browser/devtools_agent_host_registry.h"
46 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/user_metrics.h"
47 #include "content/public/common/bindings_policy.h" 47 #include "content/public/common/bindings_policy.h"
48 #include "content/public/common/content_constants.h" 48 #include "content/public/common/content_constants.h"
49 #include "content/public/common/content_restriction.h" 49 #include "content/public/common/content_restriction.h"
50 #include "content/public/common/url_constants.h" 50 #include "content/public/common/url_constants.h"
51 #include "net/base/net_util.h" 51 #include "net/base/net_util.h"
52 #include "net/url_request/url_request_context_getter.h" 52 #include "net/url_request/url_request_context_getter.h"
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
54 #include "ui/gfx/codec/png_codec.h" 54 #include "ui/gfx/codec/png_codec.h"
55 #include "webkit/glue/password_form.h" 55 #include "webkit/glue/password_form.h"
56 #include "webkit/glue/web_intent_data.h" 56 #include "webkit/glue/web_intent_data.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // 103 //
104 // It is possible that we trigger a new navigation after we have received 104 // It is possible that we trigger a new navigation after we have received
105 // a SwapOut_ACK message but before the FrameNavigation has been confirmed. 105 // a SwapOut_ACK message but before the FrameNavigation has been confirmed.
106 // In this case the old RVH has been swapped out but the new one has not 106 // In this case the old RVH has been swapped out but the new one has not
107 // replaced it, yet. Therefore, we cancel the pending RVH and skip the unloading 107 // replaced it, yet. Therefore, we cancel the pending RVH and skip the unloading
108 // of the old RVH. 108 // of the old RVH.
109 109
110 using content::DevToolsAgentHost; 110 using content::DevToolsAgentHost;
111 using content::DevToolsAgentHostRegistry; 111 using content::DevToolsAgentHostRegistry;
112 using content::DevToolsManagerImpl; 112 using content::DevToolsManagerImpl;
113 using content::UserMetricsAction;
113 114
114 namespace { 115 namespace {
115 116
116 // Amount of time we wait between when a key event is received and the renderer 117 // Amount of time we wait between when a key event is received and the renderer
117 // is queried for its state and pushed to the NavigationEntry. 118 // is queried for its state and pushed to the NavigationEntry.
118 const int kQueryStateDelay = 5000; 119 const int kQueryStateDelay = 5000;
119 120
120 const int kSyncWaitDelay = 40; 121 const int kSyncWaitDelay = 40;
121 122
122 static const char kDotGoogleDotCom[] = ".google.com"; 123 static const char kDotGoogleDotCom[] = ".google.com";
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) 321 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory)
321 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, 322 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler,
322 OnRegisterProtocolHandler) 323 OnRegisterProtocolHandler)
323 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) 324 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply)
324 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) 325 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
325 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) 326 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
326 IPC_MESSAGE_UNHANDLED(handled = false) 327 IPC_MESSAGE_UNHANDLED(handled = false)
327 IPC_END_MESSAGE_MAP_EX() 328 IPC_END_MESSAGE_MAP_EX()
328 329
329 if (!message_is_ok) { 330 if (!message_is_ok) {
330 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); 331 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
331 GetRenderProcessHost()->ReceivedBadMessage(); 332 GetRenderProcessHost()->ReceivedBadMessage();
332 } 333 }
333 334
334 return handled; 335 return handled;
335 } 336 }
336 337
337 void TabContents::RunFileChooser( 338 void TabContents::RunFileChooser(
338 RenderViewHost* render_view_host, 339 RenderViewHost* render_view_host,
339 const content::FileChooserParams& params) { 340 const content::FileChooserParams& params) {
340 delegate()->RunFileChooser(this, params); 341 delegate()->RunFileChooser(this, params);
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 LoadFromMemoryCacheDetails details(url, GetRenderProcessHost()->GetID(), 1066 LoadFromMemoryCacheDetails details(url, GetRenderProcessHost()->GetID(),
1066 cert_id, cert_status); 1067 cert_id, cert_status);
1067 1068
1068 content::NotificationService::current()->Notify( 1069 content::NotificationService::current()->Notify(
1069 content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, 1070 content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
1070 content::Source<NavigationController>(&controller_), 1071 content::Source<NavigationController>(&controller_),
1071 content::Details<LoadFromMemoryCacheDetails>(&details)); 1072 content::Details<LoadFromMemoryCacheDetails>(&details));
1072 } 1073 }
1073 1074
1074 void TabContents::OnDidDisplayInsecureContent() { 1075 void TabContents::OnDidDisplayInsecureContent() {
1075 UserMetrics::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent")); 1076 content::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent"));
1076 displayed_insecure_content_ = true; 1077 displayed_insecure_content_ = true;
1077 SSLManager::NotifySSLInternalStateChanged(&controller()); 1078 SSLManager::NotifySSLInternalStateChanged(&controller());
1078 } 1079 }
1079 1080
1080 void TabContents::OnDidRunInsecureContent( 1081 void TabContents::OnDidRunInsecureContent(
1081 const std::string& security_origin, const GURL& target_url) { 1082 const std::string& security_origin, const GURL& target_url) {
1082 LOG(INFO) << security_origin << " ran insecure content from " 1083 LOG(INFO) << security_origin << " ran insecure content from "
1083 << target_url.possibly_invalid_spec(); 1084 << target_url.possibly_invalid_spec();
1084 UserMetrics::RecordAction(UserMetricsAction("SSL.RanInsecureContent")); 1085 content::RecordAction(UserMetricsAction("SSL.RanInsecureContent"));
1085 if (EndsWith(security_origin, kDotGoogleDotCom, false)) { 1086 if (EndsWith(security_origin, kDotGoogleDotCom, false)) {
1086 UserMetrics::RecordAction( 1087 content::RecordAction(
1087 UserMetricsAction("SSL.RanInsecureContentGoogle")); 1088 UserMetricsAction("SSL.RanInsecureContentGoogle"));
1088 } 1089 }
1089 controller_.ssl_manager()->DidRunInsecureContent(security_origin); 1090 controller_.ssl_manager()->DidRunInsecureContent(security_origin);
1090 displayed_insecure_content_ = true; 1091 displayed_insecure_content_ = true;
1091 SSLManager::NotifySSLInternalStateChanged(&controller()); 1092 SSLManager::NotifySSLInternalStateChanged(&controller());
1092 } 1093 }
1093 1094
1094 void TabContents::OnDocumentLoadedInFrame(int64 frame_id) { 1095 void TabContents::OnDocumentLoadedInFrame(int64 frame_id) {
1095 controller_.DocumentLoadedInFrame(); 1096 controller_.DocumentLoadedInFrame();
1096 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1097 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2069 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2069 // Can be NULL during tests. 2070 // Can be NULL during tests.
2070 if (rwh_view) 2071 if (rwh_view)
2071 rwh_view->SetSize(view()->GetContainerSize()); 2072 rwh_view->SetSize(view()->GetContainerSize());
2072 } 2073 }
2073 2074
2074 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { 2075 bool TabContents::GotResponseToLockMouseRequest(bool allowed) {
2075 return render_view_host() ? 2076 return render_view_host() ?
2076 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; 2077 render_view_host()->GotResponseToLockMouseRequest(allowed) : false;
2077 } 2078 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698