Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/message_handler.h" | 5 #include "chrome/browser/extensions/message_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/messaging/message_service.h" | 7 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/extensions/extension_messages.h" | 10 #include "chrome/common/extensions/extension_messages.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 WebContents* web_contents = | 39 WebContents* web_contents = |
| 40 WebContents::FromRenderViewHost(render_view_host()); | 40 WebContents::FromRenderViewHost(render_view_host()); |
| 41 Send(new ExtensionMsg_NotifyRenderViewType( | 41 Send(new ExtensionMsg_NotifyRenderViewType( |
| 42 routing_id(), extensions::GetViewType(web_contents))); | 42 routing_id(), extensions::GetViewType(web_contents))); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void MessageHandler::OnPostMessage(int port_id, | 45 void MessageHandler::OnPostMessage(int port_id, |
| 46 const std::string& message) { | 46 const std::string& message) { |
| 47 Profile* profile = Profile::FromBrowserContext( | 47 Profile* profile = Profile::FromBrowserContext( |
| 48 render_view_host()->GetProcess()->GetBrowserContext()); | 48 render_view_host()->GetProcess()->GetBrowserContext()); |
| 49 MessageService* message_service = | 49 MessageService* message_service = ProfileKeyedAPIFactory<MessageService>:: |
|
Devlin
2013/04/26 01:21:25
Convenience method :) (Also, we don't usually wra
Patrick Riordan
2013/04/26 02:18:45
Done.
| |
| 50 ExtensionSystem::Get(profile)->message_service(); | 50 GetForProfile(profile); |
| 51 if (message_service) { | 51 if (message_service) { |
| 52 message_service->PostMessage(port_id, message); | 52 message_service->PostMessage(port_id, message); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace extensions | 56 } // namespace extensions |
| OLD | NEW |