OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/chromeos/launcher_search_provider/error_reporter.h" | 5 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" |
6 | 6 |
| 7 #include "content/public/browser/render_frame_host.h" |
7 #include "content/public/common/console_message_level.h" | 8 #include "content/public/common/console_message_level.h" |
8 #include "extensions/common/extension_messages.h" | |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
11 namespace launcher_search_provider { | 11 namespace launcher_search_provider { |
12 | 12 |
13 ErrorReporter::ErrorReporter(IPC::Sender* sender, const int routing_id) | 13 ErrorReporter::ErrorReporter(content::RenderFrameHost* host) : host_(host) { |
14 : sender_(sender), routing_id_(routing_id) { | |
15 } | 14 } |
16 | 15 |
17 ErrorReporter::~ErrorReporter() { | 16 ErrorReporter::~ErrorReporter() { |
18 } | 17 } |
19 | 18 |
20 void ErrorReporter::Warn(const std::string& message) { | 19 void ErrorReporter::Warn(const std::string& message) { |
21 DCHECK(sender_); | 20 DCHECK(host_); |
22 | 21 |
23 sender_->Send(new ExtensionMsg_AddMessageToConsole( | 22 host_->AddMessageToConsole( |
24 routing_id_, content::ConsoleMessageLevel::CONSOLE_MESSAGE_LEVEL_WARNING, | 23 content::ConsoleMessageLevel::CONSOLE_MESSAGE_LEVEL_WARNING, message); |
25 message)); | |
26 } | 24 } |
27 | 25 |
28 scoped_ptr<ErrorReporter> ErrorReporter::Duplicate() { | 26 scoped_ptr<ErrorReporter> ErrorReporter::Duplicate() { |
29 return make_scoped_ptr(new ErrorReporter(sender_, routing_id_)); | 27 return make_scoped_ptr(new ErrorReporter(host_)); |
30 } | 28 } |
31 | 29 |
32 } // namespace launcher_search_provider | 30 } // namespace launcher_search_provider |
33 } // namespace chromeos | 31 } // namespace chromeos |
OLD | NEW |