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

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: Cleanup Created 8 years, 1 month 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 // Verify that the profile is not on a network share and if so prepare to show 1271 // Verify that the profile is not on a network share and if so prepare to show
1279 // notification to the user. 1272 // notification to the user.
1280 if (NetworkProfileBubble::ShouldCheckNetworkProfile(profile_)) { 1273 if (NetworkProfileBubble::ShouldCheckNetworkProfile(profile_)) {
1281 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, 1274 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE,
1282 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, 1275 base::Bind(&NetworkProfileBubble::CheckNetworkProfile,
1283 profile_->GetPath())); 1276 profile_->GetPath()));
1284 } 1277 }
1285 #endif // OS_WIN 1278 #endif // OS_WIN
1286 1279
1287 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1280 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1288 // TODO(ivankr): do this on user login on ChromeOS.
1289 // Init the RLZ library. This just binds the dll and schedules a task on the 1281 // Init the RLZ library. This just binds the dll and schedules a task on the
1290 // file thread to be run sometime later. If this is the first run we record 1282 // file thread to be run sometime later. If this is the first run we record
1291 // the installation event. 1283 // the installation event.
1292 bool is_google_default_search = false;
1293 TemplateURLService* template_url_service =
1294 TemplateURLServiceFactory::GetForProfile(profile_);
1295 if (template_url_service) {
1296 const TemplateURL* url_template =
1297 template_url_service->GetDefaultSearchProvider();
1298 is_google_default_search =
1299 url_template && url_template->url_ref().HasGoogleBaseURLs();
1300 }
1301
1302 PrefService* pref_service = profile_->GetPrefs(); 1284 PrefService* pref_service = profile_->GetPrefs();
1303 bool is_google_homepage = google_util::IsGoogleHomePageUrl(
1304 pref_service->GetString(prefs::kHomePage));
1305
1306 bool is_google_in_startpages = false;
1307 SessionStartupPref session_startup_prefs =
1308 StartupBrowserCreator::GetSessionStartupPref(parsed_command_line(),
1309 profile_);
1310 if (session_startup_prefs.type == SessionStartupPref::URLS) {
1311 is_google_in_startpages = std::count_if(session_startup_prefs.urls.begin(),
1312 session_startup_prefs.urls.end(),
1313 IsGoogleUrl) > 0;
1314 }
1315
1316 int ping_delay = is_first_run_ ? master_prefs_->ping_delay : 1285 int ping_delay = is_first_run_ ? master_prefs_->ping_delay :
1317 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); 1286 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str());
1318 RLZTracker::InitRlzDelayed(is_first_run_, ping_delay, 1287 RLZTracker::InitRlzFromProfileDelayed(profile_, is_first_run_, ping_delay);
1319 is_google_default_search, is_google_homepage,
1320 is_google_in_startpages);
1321
1322 // Prime the RLZ cache for the home page access point so that its avaiable
1323 // for the startup page if needed (i.e., when the startup page is set to
1324 // the home page).
1325 RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL);
1326 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1288 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1327 1289
1328 // Configure modules that need access to resources. 1290 // Configure modules that need access to resources.
1329 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); 1291 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);
1330 1292
1331 // In unittest mode, this will do nothing. In normal mode, this will create 1293 // In unittest mode, this will do nothing. In normal mode, this will create
1332 // the global IntranetRedirectDetector instance, which will promptly go to 1294 // the global IntranetRedirectDetector instance, which will promptly go to
1333 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards 1295 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards
1334 // to see if it should do anything else. 1296 // to see if it should do anything else.
1335 // 1297 //
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 if (base::win::GetVersion() <= base::win::VERSION_XP) 1689 if (base::win::GetVersion() <= base::win::VERSION_XP)
1728 uma_name += "_XP"; 1690 uma_name += "_XP";
1729 1691
1730 uma_name += "_PreRead_"; 1692 uma_name += "_PreRead_";
1731 uma_name += pre_read_percentage; 1693 uma_name += pre_read_percentage;
1732 AddPreReadHistogramTime(uma_name.c_str(), time); 1694 AddPreReadHistogramTime(uma_name.c_str(), time);
1733 } 1695 }
1734 #endif 1696 #endif
1735 #endif 1697 #endif
1736 } 1698 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698