Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/search_engines/search_provider_install_state_message_filter.cc

Issue 10071036: RefCounted types should not have public destructors, chrome/browser/ part 6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 12 matching lines...) Expand all
23 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 23 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
24 provider_data_(profile, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 24 provider_data_(profile, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
25 content::Source<content::RenderProcessHost>( 25 content::Source<content::RenderProcessHost>(
26 content::RenderProcessHost::FromID(render_process_id))), 26 content::RenderProcessHost::FromID(render_process_id))),
27 is_off_the_record_(profile->IsOffTheRecord()) { 27 is_off_the_record_(profile->IsOffTheRecord()) {
28 // This is initialized by RenderProcessHostImpl. Do not add any non-trivial 28 // This is initialized by RenderProcessHostImpl. Do not add any non-trivial
29 // initialization here. Instead do it lazily when required. 29 // initialization here. Instead do it lazily when required.
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
31 } 31 }
32 32
33 SearchProviderInstallStateMessageFilter::
34 ~SearchProviderInstallStateMessageFilter() {
35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
36 }
37
38 bool SearchProviderInstallStateMessageFilter::OnMessageReceived( 33 bool SearchProviderInstallStateMessageFilter::OnMessageReceived(
39 const IPC::Message& message, 34 const IPC::Message& message,
40 bool* message_was_ok) { 35 bool* message_was_ok) {
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
42 bool handled = true; 37 bool handled = true;
43 IPC_BEGIN_MESSAGE_MAP_EX(SearchProviderInstallStateMessageFilter, message, 38 IPC_BEGIN_MESSAGE_MAP_EX(SearchProviderInstallStateMessageFilter, message,
44 *message_was_ok) 39 *message_was_ok)
45 IPC_MESSAGE_HANDLER_DELAY_REPLY( 40 IPC_MESSAGE_HANDLER_DELAY_REPLY(
46 ChromeViewHostMsg_GetSearchProviderInstallState, 41 ChromeViewHostMsg_GetSearchProviderInstallState,
47 OnMsgGetSearchProviderInstallState) 42 OnMsgGetSearchProviderInstallState)
48 IPC_MESSAGE_UNHANDLED(handled = false) 43 IPC_MESSAGE_UNHANDLED(handled = false)
49 IPC_END_MESSAGE_MAP() 44 IPC_END_MESSAGE_MAP()
50 return handled; 45 return handled;
51 } 46 }
52 47
48 SearchProviderInstallStateMessageFilter::
49 ~SearchProviderInstallStateMessageFilter() {
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
51 }
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)
61 return search_provider::DENIED; 61 return search_provider::DENIED;
62 62
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698