OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" |
| 6 |
| 7 #include "chrome/browser/chromeos/launcher_search_provider/test_util.h" |
| 8 #include "content/public/common/console_message_level.h" |
| 9 #include "extensions/common/extension_messages.h" |
| 10 #include "extensions/common/value_builder.h" |
| 11 |
| 12 namespace chromeos { |
| 13 namespace launcher_search_provider { |
| 14 |
| 15 ErrorReporter::ErrorReporter(IPC::Sender* sender, |
| 16 const int routing_id, |
| 17 Profile* profile) |
| 18 : sender_(sender), routing_id_(routing_id), profile_(profile) { |
| 19 } |
| 20 |
| 21 void ErrorReporter::Warn(const std::string& message) { |
| 22 if (sender_ == nullptr) |
| 23 return; |
| 24 |
| 25 sender_->Send(new ExtensionMsg_AddMessageToConsole( |
| 26 routing_id_, content::ConsoleMessageLevel::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 27 message)); |
| 28 |
| 29 // Sends warning message to test extension. |
| 30 TestUtil::SendMessageToTestExtension( |
| 31 profile_, extensions::DictionaryBuilder() |
| 32 .Set("functionName", "ErrorReporter::Warn") |
| 33 .Set("message", message) |
| 34 .ToJSON()); |
| 35 } |
| 36 |
| 37 } // namespace launcher_search_provider |
| 38 } // namespace chromeos |
OLD | NEW |