| 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/search_engines/search_provider_install_state_message_fi
lter.h" | 5 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/google/google_url_tracker_factory.h" | 9 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 Profile* profile) | 22 Profile* profile) |
| 23 : BrowserMessageFilter(ChromeMsgStart), | 23 : BrowserMessageFilter(ChromeMsgStart), |
| 24 provider_data_(TemplateURLServiceFactory::GetForProfile(profile), | 24 provider_data_(TemplateURLServiceFactory::GetForProfile(profile), |
| 25 UIThreadSearchTermsData(profile).GoogleBaseURLValue(), | 25 UIThreadSearchTermsData(profile).GoogleBaseURLValue(), |
| 26 GoogleURLTrackerFactory::GetForProfile(profile), | 26 GoogleURLTrackerFactory::GetForProfile(profile), |
| 27 content::RenderProcessHost::FromID(render_process_id)), | 27 content::RenderProcessHost::FromID(render_process_id)), |
| 28 is_off_the_record_(profile->IsOffTheRecord()), | 28 is_off_the_record_(profile->IsOffTheRecord()), |
| 29 weak_factory_(this) { | 29 weak_factory_(this) { |
| 30 // This is initialized by RenderProcessHostImpl. Do not add any non-trivial | 30 // This is initialized by RenderProcessHostImpl. Do not add any non-trivial |
| 31 // initialization here. Instead do it lazily when required. | 31 // initialization here. Instead do it lazily when required. |
| 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 32 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool SearchProviderInstallStateMessageFilter::OnMessageReceived( | 35 bool SearchProviderInstallStateMessageFilter::OnMessageReceived( |
| 36 const IPC::Message& message) { | 36 const IPC::Message& message) { |
| 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 37 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 38 bool handled = true; | 38 bool handled = true; |
| 39 IPC_BEGIN_MESSAGE_MAP(SearchProviderInstallStateMessageFilter, message) | 39 IPC_BEGIN_MESSAGE_MAP(SearchProviderInstallStateMessageFilter, message) |
| 40 IPC_MESSAGE_HANDLER_DELAY_REPLY( | 40 IPC_MESSAGE_HANDLER_DELAY_REPLY( |
| 41 ChromeViewHostMsg_GetSearchProviderInstallState, | 41 ChromeViewHostMsg_GetSearchProviderInstallState, |
| 42 OnGetSearchProviderInstallState) | 42 OnGetSearchProviderInstallState) |
| 43 IPC_MESSAGE_UNHANDLED(handled = false) | 43 IPC_MESSAGE_UNHANDLED(handled = false) |
| 44 IPC_END_MESSAGE_MAP() | 44 IPC_END_MESSAGE_MAP() |
| 45 return handled; | 45 return handled; |
| 46 } | 46 } |
| 47 | 47 |
| 48 SearchProviderInstallStateMessageFilter:: | 48 SearchProviderInstallStateMessageFilter:: |
| 49 ~SearchProviderInstallStateMessageFilter() { | 49 ~SearchProviderInstallStateMessageFilter() { |
| 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 50 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 51 } | 51 } |
| 52 | 52 |
| 53 search_provider::InstallState | 53 search_provider::InstallState |
| 54 SearchProviderInstallStateMessageFilter::GetSearchProviderInstallState( | 54 SearchProviderInstallStateMessageFilter::GetSearchProviderInstallState( |
| 55 const GURL& page_location, | 55 const GURL& page_location, |
| 56 const GURL& requested_host) { | 56 const GURL& requested_host) { |
| 57 GURL requested_origin = requested_host.GetOrigin(); | 57 GURL requested_origin = requested_host.GetOrigin(); |
| 58 | 58 |
| 59 // Do the security check before any others to avoid information leaks. | 59 // Do the security check before any others to avoid information leaks. |
| 60 if (page_location.GetOrigin() != requested_origin) | 60 if (page_location.GetOrigin() != requested_origin) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 IPC::Message* reply_msg) { | 102 IPC::Message* reply_msg) { |
| 103 DCHECK(reply_msg); | 103 DCHECK(reply_msg); |
| 104 search_provider::InstallState install_state = | 104 search_provider::InstallState install_state = |
| 105 GetSearchProviderInstallState(page_location, requested_host); | 105 GetSearchProviderInstallState(page_location, requested_host); |
| 106 | 106 |
| 107 ChromeViewHostMsg_GetSearchProviderInstallState::WriteReplyParams( | 107 ChromeViewHostMsg_GetSearchProviderInstallState::WriteReplyParams( |
| 108 reply_msg, | 108 reply_msg, |
| 109 install_state); | 109 install_state); |
| 110 Send(reply_msg); | 110 Send(reply_msg); |
| 111 } | 111 } |
| OLD | NEW |