Index: chrome/browser/chromeos/launcher_search_provider/error_reporter.cc |
diff --git a/chrome/browser/chromeos/launcher_search_provider/error_reporter.cc b/chrome/browser/chromeos/launcher_search_provider/error_reporter.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..52f7ef4bab27bb8c30e88a1f324fd0b67844de4a |
--- /dev/null |
+++ b/chrome/browser/chromeos/launcher_search_provider/error_reporter.cc |
@@ -0,0 +1,38 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" |
+ |
+#include "chrome/browser/chromeos/launcher_search_provider/test_util.h" |
+#include "content/public/common/console_message_level.h" |
+#include "extensions/common/extension_messages.h" |
+#include "extensions/common/value_builder.h" |
+ |
+namespace chromeos { |
+namespace launcher_search_provider { |
+ |
+ErrorReporter::ErrorReporter(IPC::Sender* sender, |
+ const int routing_id, |
+ Profile* profile) |
+ : sender_(sender), routing_id_(routing_id), profile_(profile) { |
+} |
+ |
+void ErrorReporter::Warn(const std::string& message) { |
+ if (sender_ == nullptr) |
+ return; |
+ |
+ sender_->Send(new ExtensionMsg_AddMessageToConsole( |
+ routing_id_, content::ConsoleMessageLevel::CONSOLE_MESSAGE_LEVEL_WARNING, |
+ message)); |
+ |
+ // Sends warning message to test extension. |
+ TestUtil::SendMessageToTestExtension( |
+ profile_, extensions::DictionaryBuilder() |
+ .Set("functionName", "ErrorReporter::Warn") |
+ .Set("message", message) |
+ .ToJSON()); |
+} |
+ |
+} // namespace launcher_search_provider |
+} // namespace chromeos |