OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 in_startup_sleep_(true), | 98 in_startup_sleep_(true), |
99 already_fetched_(false), | 99 already_fetched_(false), |
100 need_to_fetch_(false), | 100 need_to_fetch_(false), |
101 request_context_available_(!!Profile::GetDefaultRequestContext()), | 101 request_context_available_(!!Profile::GetDefaultRequestContext()), |
102 need_to_prompt_(false), | 102 need_to_prompt_(false), |
103 controller_(NULL), | 103 controller_(NULL), |
104 infobar_(NULL) { | 104 infobar_(NULL) { |
105 registrar_.Add(this, NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, | 105 registrar_.Add(this, NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, |
106 NotificationService::AllSources()); | 106 NotificationService::AllSources()); |
107 | 107 |
108 net::NetworkChangeNotifier::AddObserver(this); | 108 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
109 | 109 |
110 MessageLoop::current()->PostTask(FROM_HERE, | 110 MessageLoop::current()->PostTask(FROM_HERE, |
111 runnable_method_factory_.NewRunnableMethod( | 111 runnable_method_factory_.NewRunnableMethod( |
112 &GoogleURLTracker::QueueWakeupTask)); | 112 &GoogleURLTracker::QueueWakeupTask)); |
113 } | 113 } |
114 | 114 |
115 GoogleURLTracker::~GoogleURLTracker() { | 115 GoogleURLTracker::~GoogleURLTracker() { |
116 runnable_method_factory_.RevokeAll(); | 116 runnable_method_factory_.RevokeAll(); |
117 net::NetworkChangeNotifier::RemoveObserver(this); | 117 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
118 } | 118 } |
119 | 119 |
120 // static | 120 // static |
121 GURL GoogleURLTracker::GoogleURL() { | 121 GURL GoogleURLTracker::GoogleURL() { |
122 const GoogleURLTracker* const tracker = | 122 const GoogleURLTracker* const tracker = |
123 g_browser_process->google_url_tracker(); | 123 g_browser_process->google_url_tracker(); |
124 return tracker ? tracker->google_url_ : GURL(kDefaultGoogleHomepage); | 124 return tracker ? tracker->google_url_ : GURL(kDefaultGoogleHomepage); |
125 } | 125 } |
126 | 126 |
127 // static | 127 // static |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 367 } |
368 | 368 |
369 void GoogleURLTracker::ShowGoogleURLInfoBarIfNecessary( | 369 void GoogleURLTracker::ShowGoogleURLInfoBarIfNecessary( |
370 TabContents* tab_contents) { | 370 TabContents* tab_contents) { |
371 if (!need_to_prompt_) | 371 if (!need_to_prompt_) |
372 return; | 372 return; |
373 DCHECK(!fetched_google_url_.is_empty()); | 373 DCHECK(!fetched_google_url_.is_empty()); |
374 | 374 |
375 infobar_ = (*infobar_creator_)(tab_contents, this, fetched_google_url_); | 375 infobar_ = (*infobar_creator_)(tab_contents, this, fetched_google_url_); |
376 } | 376 } |
OLD | NEW |