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

Side by Side Diff: chrome/browser/extensions/extension_function.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: Version for commit (merged again). 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 "chrome/browser/extensions/extension_function.h" 5 #include "chrome/browser/extensions/extension_function.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/extensions/extension_function_dispatcher.h" 9 #include "chrome/browser/extensions/extension_function_dispatcher.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 12 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
13 #include "chrome/common/extensions/extension_messages.h" 13 #include "chrome/common/extensions/extension_messages.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/user_metrics.h"
16 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/notification_types.h" 16 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/user_metrics.h"
19 #include "content/public/common/result_codes.h" 19 #include "content/public/common/result_codes.h"
20 20
21 using content::BrowserThread; 21 using content::BrowserThread;
22 using content::UserMetricsAction;
22 23
23 // static 24 // static
24 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) { 25 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) {
25 x->Destruct(); 26 x->Destruct();
26 } 27 }
27 28
28 UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker( 29 UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker(
29 UIThreadExtensionFunction* function, 30 UIThreadExtensionFunction* function,
30 RenderViewHost* render_view_host) 31 RenderViewHost* render_view_host)
31 : content::RenderViewHostObserver(render_view_host), 32 : content::RenderViewHostObserver(render_view_host),
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 routing_id, request_id_, success, GetResult(), GetError())); 129 routing_id, request_id_, success, GetResult(), GetError()));
129 } 130 }
130 131
131 void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { 132 void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) {
132 LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; 133 LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer.";
133 if (content::RenderProcessHost::run_renderer_in_process()) { 134 if (content::RenderProcessHost::run_renderer_in_process()) {
134 // In single process mode it is better if we don't suicide but just crash. 135 // In single process mode it is better if we don't suicide but just crash.
135 CHECK(false); 136 CHECK(false);
136 } else { 137 } else {
137 NOTREACHED(); 138 NOTREACHED();
138 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_EFD")); 139 content::RecordAction(UserMetricsAction("BadMessageTerminate_EFD"));
139 if (process) 140 if (process)
140 base::KillProcess(process, content::RESULT_CODE_KILLED_BAD_MESSAGE, 141 base::KillProcess(process, content::RESULT_CODE_KILLED_BAD_MESSAGE,
141 false); 142 false);
142 } 143 }
143 } 144 }
144 UIThreadExtensionFunction::UIThreadExtensionFunction() 145 UIThreadExtensionFunction::UIThreadExtensionFunction()
145 : render_view_host_(NULL), profile_(NULL), delegate_(NULL) { 146 : render_view_host_(NULL), profile_(NULL), delegate_(NULL) {
146 } 147 }
147 148
148 UIThreadExtensionFunction::~UIThreadExtensionFunction() { 149 UIThreadExtensionFunction::~UIThreadExtensionFunction() {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 230
230 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { 231 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() {
231 } 232 }
232 233
233 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { 234 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() {
234 } 235 }
235 236
236 void SyncIOThreadExtensionFunction::Run() { 237 void SyncIOThreadExtensionFunction::Run() {
237 SendResponse(RunImpl()); 238 SendResponse(RunImpl());
238 } 239 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/extension_metrics_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698