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

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

Issue 11412067: [rlz,cros] RLZ glue for ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Header guard Created 8 years 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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
11 #include <algorithm>
12 #include <string> 11 #include <string>
13 #include <vector> 12 #include <vector>
14 13
15 #include "base/at_exit.h" 14 #include "base/at_exit.h"
16 #include "base/bind.h" 15 #include "base/bind.h"
17 #include "base/command_line.h" 16 #include "base/command_line.h"
18 #include "base/debug/trace_event.h" 17 #include "base/debug/trace_event.h"
19 #include "base/file_path.h" 18 #include "base/file_path.h"
20 #include "base/file_util.h" 19 #include "base/file_util.h"
21 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( 476 StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
478 command_line, current_directory); 477 command_line, current_directory);
479 return true; 478 return true;
480 } 479 }
481 480
482 bool HasImportSwitch(const CommandLine& command_line) { 481 bool HasImportSwitch(const CommandLine& command_line) {
483 return (command_line.HasSwitch(switches::kImport) || 482 return (command_line.HasSwitch(switches::kImport) ||
484 command_line.HasSwitch(switches::kImportFromFile)); 483 command_line.HasSwitch(switches::kImportFromFile));
485 } 484 }
486 485
487 #if defined(ENABLE_RLZ)
488 bool IsGoogleUrl(const GURL& url) {
489 return google_util::IsGoogleHomePageUrl(url.possibly_invalid_spec());
490 }
491 #endif
492
493 } // namespace 486 } // namespace
494 487
495 namespace chrome_browser { 488 namespace chrome_browser {
496 // This error message is not localized because we failed to load the 489 // This error message is not localized because we failed to load the
497 // localization data files. 490 // localization data files.
498 const char kMissingLocaleDataTitle[] = "Missing File Error"; 491 const char kMissingLocaleDataTitle[] = "Missing File Error";
499 const char kMissingLocaleDataMessage[] = 492 const char kMissingLocaleDataMessage[] =
500 "Unable to find locale data files. Please reinstall."; 493 "Unable to find locale data files. Please reinstall.";
501 } // namespace chrome_browser 494 } // namespace chrome_browser
502 495
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 // Verify that the profile is not on a network share and if so prepare to show 1257 // Verify that the profile is not on a network share and if so prepare to show
1265 // notification to the user. 1258 // notification to the user.
1266 if (NetworkProfileBubble::ShouldCheckNetworkProfile(profile_)) { 1259 if (NetworkProfileBubble::ShouldCheckNetworkProfile(profile_)) {
1267 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, 1260 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE,
1268 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, 1261 base::Bind(&NetworkProfileBubble::CheckNetworkProfile,
1269 profile_->GetPath())); 1262 profile_->GetPath()));
1270 } 1263 }
1271 #endif // OS_WIN 1264 #endif // OS_WIN
1272 1265
1273 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1266 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1274 // TODO(ivankr): do this on user login on ChromeOS.
1275 // Init the RLZ library. This just binds the dll and schedules a task on the 1267 // Init the RLZ library. This just binds the dll and schedules a task on the
1276 // file thread to be run sometime later. If this is the first run we record 1268 // file thread to be run sometime later. If this is the first run we record
1277 // the installation event. 1269 // the installation event.
1278 bool is_google_default_search = false;
1279 TemplateURLService* template_url_service =
1280 TemplateURLServiceFactory::GetForProfile(profile_);
1281 if (template_url_service) {
1282 const TemplateURL* url_template =
1283 template_url_service->GetDefaultSearchProvider();
1284 is_google_default_search =
1285 url_template && url_template->url_ref().HasGoogleBaseURLs();
1286 }
1287
1288 PrefService* pref_service = profile_->GetPrefs(); 1270 PrefService* pref_service = profile_->GetPrefs();
1289 bool is_google_homepage = google_util::IsGoogleHomePageUrl(
1290 pref_service->GetString(prefs::kHomePage));
1291
1292 bool is_google_in_startpages = false;
1293 SessionStartupPref session_startup_prefs =
1294 StartupBrowserCreator::GetSessionStartupPref(parsed_command_line(),
1295 profile_);
1296 if (session_startup_prefs.type == SessionStartupPref::URLS) {
1297 is_google_in_startpages = std::count_if(session_startup_prefs.urls.begin(),
1298 session_startup_prefs.urls.end(),
1299 IsGoogleUrl) > 0;
1300 }
1301
1302 int ping_delay = is_first_run_ ? master_prefs_->ping_delay : 1271 int ping_delay = is_first_run_ ? master_prefs_->ping_delay :
1303 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); 1272 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str());
1304 RLZTracker::InitRlzDelayed(is_first_run_, ping_delay, 1273 RLZTracker::InitRlzFromProfileDelayed(profile_, is_first_run_, ping_delay);
1305 is_google_default_search, is_google_homepage,
1306 is_google_in_startpages);
1307
1308 // Prime the RLZ cache for the home page access point so that its avaiable
1309 // for the startup page if needed (i.e., when the startup page is set to
1310 // the home page).
1311 RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL);
1312 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1274 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1313 1275
1314 // Configure modules that need access to resources. 1276 // Configure modules that need access to resources.
1315 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); 1277 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);
1316 1278
1317 // In unittest mode, this will do nothing. In normal mode, this will create 1279 // In unittest mode, this will do nothing. In normal mode, this will create
1318 // the global IntranetRedirectDetector instance, which will promptly go to 1280 // the global IntranetRedirectDetector instance, which will promptly go to
1319 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards 1281 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards
1320 // to see if it should do anything else. 1282 // to see if it should do anything else.
1321 // 1283 //
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 if (base::win::GetVersion() <= base::win::VERSION_XP) 1675 if (base::win::GetVersion() <= base::win::VERSION_XP)
1714 uma_name += "_XP"; 1676 uma_name += "_XP";
1715 1677
1716 uma_name += "_PreRead_"; 1678 uma_name += "_PreRead_";
1717 uma_name += pre_read_percentage; 1679 uma_name += pre_read_percentage;
1718 AddPreReadHistogramTime(uma_name.c_str(), time); 1680 AddPreReadHistogramTime(uma_name.c_str(), time);
1719 } 1681 }
1720 #endif 1682 #endif
1721 #endif 1683 #endif
1722 } 1684 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698