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

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

Issue 252593003: Improve UI for unpacked extensions failing to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android fix Created 6 years, 8 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 | Annotate | Revision Log
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_error_reporter.h" 5 #include "chrome/browser/extensions/extension_error_reporter.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 ExtensionErrorReporter::ExtensionErrorReporter(bool enable_noisy_errors) 31 ExtensionErrorReporter::ExtensionErrorReporter(bool enable_noisy_errors)
32 : ui_loop_(base::MessageLoop::current()), 32 : ui_loop_(base::MessageLoop::current()),
33 enable_noisy_errors_(enable_noisy_errors) { 33 enable_noisy_errors_(enable_noisy_errors) {
34 } 34 }
35 35
36 ExtensionErrorReporter::~ExtensionErrorReporter() {} 36 ExtensionErrorReporter::~ExtensionErrorReporter() {}
37 37
38 void ExtensionErrorReporter::ReportError(const base::string16& message, 38 void ExtensionErrorReporter::ReportError(const base::string16& message,
39 bool be_noisy, 39 bool be_noisy) {
40 bool* user_response) {
41 // NOTE: There won't be a ui_loop_ in the unit test environment. 40 // NOTE: There won't be a ui_loop_ in the unit test environment.
42 if (ui_loop_) { 41 if (ui_loop_) {
43 CHECK(base::MessageLoop::current() == ui_loop_) 42 CHECK(base::MessageLoop::current() == ui_loop_)
44 << "ReportError can only be called from the UI thread."; 43 << "ReportError can only be called from the UI thread.";
45 } 44 }
46 45
47 errors_.push_back(message); 46 errors_.push_back(message);
48 47
49 // TODO(aa): Print the error message out somewhere better. I think we are 48 // TODO(aa): Print the error message out somewhere better. I think we are
50 // going to need some sort of 'extension inspector'. 49 // going to need some sort of 'extension inspector'.
51 LOG(WARNING) << "Extension error: " << message; 50 LOG(WARNING) << "Extension error: " << message;
52 51
53 if (enable_noisy_errors_ && be_noisy) { 52 if (enable_noisy_errors_ && be_noisy) {
54 if (user_response) { 53 chrome::ShowMessageBox(NULL,
55 *user_response = 54 base::ASCIIToUTF16("Extension error"),
56 chrome::MESSAGE_BOX_RESULT_YES == 55 message,
57 chrome::ShowMessageBox(NULL, 56 chrome::MESSAGE_BOX_TYPE_WARNING);
58 base::ASCIIToUTF16("Extension error"),
59 message,
60 chrome::MESSAGE_BOX_TYPE_QUESTION);
61 } else {
62 chrome::ShowMessageBox(NULL,
63 base::ASCIIToUTF16("Extension error"),
64 message,
65 chrome::MESSAGE_BOX_TYPE_WARNING);
66 }
67 } 57 }
68 } 58 }
69 59
70 const std::vector<base::string16>* ExtensionErrorReporter::GetErrors() { 60 const std::vector<base::string16>* ExtensionErrorReporter::GetErrors() {
71 return &errors_; 61 return &errors_;
72 } 62 }
73 63
74 void ExtensionErrorReporter::ClearErrors() { 64 void ExtensionErrorReporter::ClearErrors() {
75 errors_.clear(); 65 errors_.clear();
76 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_error_reporter.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698