OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/signin/principals_message_filter.h" | 5 #include "chrome/browser/signin/principals_message_filter.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 | 9 |
10 PrincipalsMessageFilter::PrincipalsMessageFilter(int render_process_id) | 10 PrincipalsMessageFilter::PrincipalsMessageFilter(int render_process_id) |
11 : BrowserMessageFilter(ChromeMsgStart), | 11 : BrowserMessageFilter(ChromeMsgStart), |
12 render_process_id_(render_process_id) {} | 12 render_process_id_(render_process_id) {} |
13 | 13 |
14 PrincipalsMessageFilter::~PrincipalsMessageFilter(){} | 14 PrincipalsMessageFilter::~PrincipalsMessageFilter(){} |
15 | 15 |
16 void PrincipalsMessageFilter::OverrideThreadForMessage( | 16 void PrincipalsMessageFilter::OverrideThreadForMessage( |
17 const IPC::Message& message, | 17 const IPC::Message& message, |
18 content::BrowserThread::ID* thread) { | 18 content::BrowserThread::ID* thread) { |
19 // GetManagedAccounts message is synchronous, it must be handled in the IO | 19 // GetManagedAccounts message is synchronous, it must be handled in the IO |
20 // thread, so no need to change thread, otherwise switch to UI thread | 20 // thread, so no need to change thread, otherwise switch to UI thread |
21 if (message.type() == ChromeViewHostMsg_ShowBrowserAccountManagementUI::ID) | 21 if (message.type() == ChromeViewHostMsg_ShowBrowserAccountManagementUI::ID) |
22 *thread = content::BrowserThread::UI; | 22 *thread = content::BrowserThread::UI; |
23 } | 23 } |
24 | 24 |
25 bool PrincipalsMessageFilter::OnMessageReceived(const IPC::Message& message, | 25 bool PrincipalsMessageFilter::OnMessageReceived(const IPC::Message& message) { |
26 bool* message_was_ok) { | |
27 bool handled = true; | 26 bool handled = true; |
28 IPC_BEGIN_MESSAGE_MAP_EX(PrincipalsMessageFilter, message, *message_was_ok) | 27 IPC_BEGIN_MESSAGE_MAP(PrincipalsMessageFilter, message) |
29 IPC_MESSAGE_HANDLER( | 28 IPC_MESSAGE_HANDLER( |
30 ChromeViewHostMsg_GetManagedAccounts, OnMsgGetManagedAccounts) | 29 ChromeViewHostMsg_GetManagedAccounts, OnMsgGetManagedAccounts) |
31 IPC_MESSAGE_HANDLER( | 30 IPC_MESSAGE_HANDLER( |
32 ChromeViewHostMsg_ShowBrowserAccountManagementUI, | 31 ChromeViewHostMsg_ShowBrowserAccountManagementUI, |
33 OnMsgShowBrowserAccountManagementUI) | 32 OnMsgShowBrowserAccountManagementUI) |
34 IPC_MESSAGE_UNHANDLED(handled = false) | 33 IPC_MESSAGE_UNHANDLED(handled = false) |
35 IPC_END_MESSAGE_MAP() | 34 IPC_END_MESSAGE_MAP() |
36 return handled; | 35 return handled; |
37 } | 36 } |
38 | 37 |
39 | 38 |
40 | 39 |
41 void PrincipalsMessageFilter::OnMsgShowBrowserAccountManagementUI(){ | 40 void PrincipalsMessageFilter::OnMsgShowBrowserAccountManagementUI(){ |
42 // TODO(guohui) | 41 // TODO(guohui) |
43 } | 42 } |
44 | 43 |
45 void PrincipalsMessageFilter::OnMsgGetManagedAccounts( | 44 void PrincipalsMessageFilter::OnMsgGetManagedAccounts( |
46 const GURL& url, std::vector<std::string>* managed_accounts) { | 45 const GURL& url, std::vector<std::string>* managed_accounts) { |
47 // TODO(guohui) | 46 // TODO(guohui) |
48 } | 47 } |
49 | 48 |
OLD | NEW |