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

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

Issue 23007021: Report Javascript Runtime Errors to the Error Console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_feldman
Patch Set: Created 7 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/browser_shutdown.h" 16 #include "chrome/browser/browser_shutdown.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/extensions/error_console/error_console.h"
18 #include "chrome/browser/extensions/event_router.h" 19 #include "chrome/browser/extensions/event_router.h"
19 #include "chrome/browser/extensions/extension_process_manager.h" 20 #include "chrome/browser/extensions/extension_process_manager.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_system.h" 22 #include "chrome/browser/extensions/extension_system.h"
22 #include "chrome/browser/extensions/extension_tab_util.h" 23 #include "chrome/browser/extensions/extension_tab_util.h"
23 #include "chrome/browser/extensions/window_controller.h" 24 #include "chrome/browser/extensions/window_controller.h"
24 #include "chrome/browser/file_select_helper.h" 25 #include "chrome/browser/file_select_helper.h"
25 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 26 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" 28 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h"
(...skipping 12 matching lines...) Expand all
40 #include "chrome/common/render_messages.h" 41 #include "chrome/common/render_messages.h"
41 #include "chrome/common/url_constants.h" 42 #include "chrome/common/url_constants.h"
42 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
43 #include "content/public/browser/native_web_keyboard_event.h" 44 #include "content/public/browser/native_web_keyboard_event.h"
44 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
45 #include "content/public/browser/render_process_host.h" 46 #include "content/public/browser/render_process_host.h"
46 #include "content/public/browser/render_view_host.h" 47 #include "content/public/browser/render_view_host.h"
47 #include "content/public/browser/site_instance.h" 48 #include "content/public/browser/site_instance.h"
48 #include "content/public/browser/web_contents.h" 49 #include "content/public/browser/web_contents.h"
49 #include "content/public/browser/web_contents_view.h" 50 #include "content/public/browser/web_contents_view.h"
51 #include "extensions/browser/extension_error.h"
50 #include "extensions/browser/view_type_utils.h" 52 #include "extensions/browser/view_type_utils.h"
53 #include "extensions/common/constants.h"
51 #include "grit/browser_resources.h" 54 #include "grit/browser_resources.h"
52 #include "grit/chromium_strings.h" 55 #include "grit/chromium_strings.h"
53 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
54 #include "ui/base/keycodes/keyboard_codes.h" 57 #include "ui/base/keycodes/keyboard_codes.h"
55 #include "ui/base/l10n/l10n_util.h" 58 #include "ui/base/l10n/l10n_util.h"
56 #include "ui/base/resource/resource_bundle.h" 59 #include "ui/base/resource/resource_bundle.h"
57 60
58 #if !defined(OS_ANDROID) 61 #if !defined(OS_ANDROID)
59 #include "components/web_modal/web_contents_modal_dialog_manager.h" 62 #include "components/web_modal/web_contents_modal_dialog_manager.h"
60 #endif 63 #endif
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 switch (extension_host_type_) { 419 switch (extension_host_type_) {
417 case VIEW_TYPE_EXTENSION_INFOBAR: 420 case VIEW_TYPE_EXTENSION_INFOBAR:
418 InsertInfobarCSS(); 421 InsertInfobarCSS();
419 break; 422 break;
420 default: 423 default:
421 break; // No style sheet for other types, at the moment. 424 break; // No style sheet for other types, at the moment.
422 } 425 }
423 } 426 }
424 } 427 }
425 428
429 void ExtensionHost::OnMessageAddedToConsole(const base::string16& source,
430 const base::string16& message,
431 const base::string16& stack_trace,
432 int32 line_number,
433 logging::LogSeverity level) {
434 if (IsSourceFromAnExtension(source)) {
Yoyo Zhou 2013/08/23 22:54:54 Do we still want this test here? I'm thinking abou
Devlin 2013/08/23 23:44:30 While that's true, the bigger problem is that they
Yoyo Zhou 2013/08/23 23:55:04 Ok. I was thinking we'd only get extension errors
435 ErrorConsole::Get(profile_)->ReportError(
436 scoped_ptr<const ExtensionError>(new JavascriptRuntimeError(
437 profile_->IsOffTheRecord(),
438 source,
439 message,
440 stack_trace,
441 line_number,
442 associated_web_contents_ ?
443 associated_web_contents_->GetLastCommittedURL() :
444 GURL::EmptyGURL(),
445 level)));
446 }
447 }
448
426 void ExtensionHost::CloseContents(WebContents* contents) { 449 void ExtensionHost::CloseContents(WebContents* contents) {
427 // TODO(mpcomplete): is this check really necessary? 450 // TODO(mpcomplete): is this check really necessary?
428 if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP || 451 if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP ||
429 extension_host_type_ == VIEW_TYPE_EXTENSION_DIALOG || 452 extension_host_type_ == VIEW_TYPE_EXTENSION_DIALOG ||
430 extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || 453 extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE ||
431 extension_host_type_ == VIEW_TYPE_EXTENSION_INFOBAR || 454 extension_host_type_ == VIEW_TYPE_EXTENSION_INFOBAR ||
432 extension_host_type_ == VIEW_TYPE_PANEL) { 455 extension_host_type_ == VIEW_TYPE_PANEL) {
433 Close(); 456 Close();
434 } 457 }
435 } 458 }
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 663
641 void ExtensionHost::RequestMediaAccessPermission( 664 void ExtensionHost::RequestMediaAccessPermission(
642 content::WebContents* web_contents, 665 content::WebContents* web_contents,
643 const content::MediaStreamRequest& request, 666 const content::MediaStreamRequest& request,
644 const content::MediaResponseCallback& callback) { 667 const content::MediaResponseCallback& callback) {
645 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( 668 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
646 web_contents, request, callback, extension()); 669 web_contents, request, callback, extension());
647 } 670 }
648 671
649 } // namespace extensions 672 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698