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

Side by Side Diff: chrome/browser/google_url_tracker.cc

Issue 3149: Porting changes in chrome/{browser,common}, also enabling more unit tests.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_url_tracker.h" 5 #include "chrome/browser/google_url_tracker.h"
6 6
7 #include "base/compiler_specific.h"
7 #include "base/string_util.h" 8 #include "base/string_util.h"
8 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
10 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
11 #include "chrome/common/pref_service.h" 12 #include "chrome/common/pref_service.h"
12 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
13 14
14 const char GoogleURLTracker::kDefaultGoogleHomepage[] = 15 const char GoogleURLTracker::kDefaultGoogleHomepage[] =
15 "http://www.google.com/"; 16 "http://www.google.com/";
16 17
17 GoogleURLTracker::GoogleURLTracker() 18 GoogleURLTracker::GoogleURLTracker()
18 : google_url_(g_browser_process->local_state()->GetString( 19 : google_url_(WideToUTF8(g_browser_process->local_state()->GetString(
19 prefs::kLastKnownGoogleURL)), 20 prefs::kLastKnownGoogleURL))),
20 #pragma warning(suppress: 4355) // Okay to pass "this" here. 21 ALLOW_THIS_IN_INITIALIZER_LIST(fetcher_factory_(this)),
21 fetcher_factory_(this),
22 in_startup_sleep_(true), 22 in_startup_sleep_(true),
23 already_fetched_(false), 23 already_fetched_(false),
24 need_to_fetch_(false), 24 need_to_fetch_(false),
25 request_context_available_(!!Profile::GetDefaultRequestContext()) { 25 request_context_available_(!!Profile::GetDefaultRequestContext()) {
26 NotificationService::current()->AddObserver(this, 26 NotificationService::current()->AddObserver(this,
27 NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE, 27 NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE,
28 NotificationService::AllSources()); 28 NotificationService::AllSources());
29 29
30 // Because this function can be called during startup, when kicking off a URL 30 // Because this function can be called during startup, when kicking off a URL
31 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully 31 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 } 162 }
163 163
164 void GoogleURLTracker::Observe(NotificationType type, 164 void GoogleURLTracker::Observe(NotificationType type,
165 const NotificationSource& source, 165 const NotificationSource& source,
166 const NotificationDetails& details) { 166 const NotificationDetails& details) {
167 DCHECK_EQ(NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE, type); 167 DCHECK_EQ(NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE, type);
168 request_context_available_ = true; 168 request_context_available_ = true;
169 StartFetchIfDesirable(); 169 StartFetchIfDesirable();
170 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698