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

Side by Side Diff: extensions/browser/extension_host.cc

Issue 1009583004: Add UMA histograms and logging for bad IPC message handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/extension_host.h" 5 #include "extensions/browser/extension_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/public/browser/bad_message.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/content_browser_client.h" 15 #include "content/public/browser/content_browser_client.h"
15 #include "content/public/browser/native_web_keyboard_event.h" 16 #include "content/public/browser/native_web_keyboard_event.h"
16 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/render_widget_host_view.h" 20 #include "content/public/browser/render_widget_host_view.h"
20 #include "content/public/browser/site_instance.h" 21 #include "content/public/browser/site_instance.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "extensions/browser/event_router.h" 23 #include "extensions/browser/event_router.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // This way if a renderer _is_ compromised, it can really only affect itself. 361 // This way if a renderer _is_ compromised, it can really only affect itself.
361 if (unacked_messages_.erase(event_id) > 0) { 362 if (unacked_messages_.erase(event_id) > 0) {
362 FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, 363 FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_,
363 OnBackgroundEventAcked(this, event_id)); 364 OnBackgroundEventAcked(this, event_id));
364 } else { 365 } else {
365 // We have received an unexpected event id from the renderer. It might be 366 // We have received an unexpected event id from the renderer. It might be
366 // compromised or it might have some other issue. Kill it just to be safe. 367 // compromised or it might have some other issue. Kill it just to be safe.
367 DCHECK(render_process_host()); 368 DCHECK(render_process_host());
368 LOG(ERROR) << "Killing renderer for extension " << extension_id() << " for " 369 LOG(ERROR) << "Killing renderer for extension " << extension_id() << " for "
369 << "sending an EventAck message with a bad event id."; 370 << "sending an EventAck message with a bad event id.";
370 render_process_host()->ReceivedBadMessage(); 371 render_process_host()->ReceivedBadMessage(
372 content::BadMessage::EH_BAD_EVENT_ID);
371 } 373 }
372 } 374 }
373 375
374 void ExtensionHost::OnIncrementLazyKeepaliveCount() { 376 void ExtensionHost::OnIncrementLazyKeepaliveCount() {
375 ProcessManager::Get(browser_context_) 377 ProcessManager::Get(browser_context_)
376 ->IncrementLazyKeepaliveCount(extension()); 378 ->IncrementLazyKeepaliveCount(extension());
377 } 379 }
378 380
379 void ExtensionHost::OnDecrementLazyKeepaliveCount() { 381 void ExtensionHost::OnDecrementLazyKeepaliveCount() {
380 ProcessManager::Get(browser_context_) 382 ProcessManager::Get(browser_context_)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 return delegate_->CheckMediaAccessPermission( 457 return delegate_->CheckMediaAccessPermission(
456 web_contents, security_origin, type, extension()); 458 web_contents, security_origin, type, extension());
457 } 459 }
458 460
459 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { 461 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) {
460 ViewType view_type = extensions::GetViewType(web_contents); 462 ViewType view_type = extensions::GetViewType(web_contents);
461 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; 463 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE;
462 } 464 }
463 465
464 } // namespace extensions 466 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698