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

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: Always save RLZ enabled flag. 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( 478 StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
480 command_line, current_directory); 479 command_line, current_directory);
481 return true; 480 return true;
482 } 481 }
483 482
484 bool HasImportSwitch(const CommandLine& command_line) { 483 bool HasImportSwitch(const CommandLine& command_line) {
485 return (command_line.HasSwitch(switches::kImport) || 484 return (command_line.HasSwitch(switches::kImport) ||
486 command_line.HasSwitch(switches::kImportFromFile)); 485 command_line.HasSwitch(switches::kImportFromFile));
487 } 486 }
488 487
489 #if defined(ENABLE_RLZ)
490 bool IsGoogleUrl(const GURL& url) {
491 return google_util::IsGoogleHomePageUrl(url.possibly_invalid_spec());
492 }
493 #endif
494
495 } // namespace 488 } // namespace
496 489
497 namespace chrome_browser { 490 namespace chrome_browser {
498 // This error message is not localized because we failed to load the 491 // This error message is not localized because we failed to load the
499 // localization data files. 492 // localization data files.
500 const char kMissingLocaleDataTitle[] = "Missing File Error"; 493 const char kMissingLocaleDataTitle[] = "Missing File Error";
501 const char kMissingLocaleDataMessage[] = 494 const char kMissingLocaleDataMessage[] =
502 "Unable to find locale data files. Please reinstall."; 495 "Unable to find locale data files. Please reinstall.";
503 } // namespace chrome_browser 496 } // namespace chrome_browser
504 497
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 // Verify that the profile is not on a network share and if so prepare to show 1260 // Verify that the profile is not on a network share and if so prepare to show
1268 // notification to the user. 1261 // notification to the user.
1269 if (NetworkProfileBubble::ShouldCheckNetworkProfile(profile_)) { 1262 if (NetworkProfileBubble::ShouldCheckNetworkProfile(profile_)) {
1270 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, 1263 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE,
1271 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, 1264 base::Bind(&NetworkProfileBubble::CheckNetworkProfile,
1272 profile_->GetPath())); 1265 profile_->GetPath()));
1273 } 1266 }
1274 #endif // OS_WIN 1267 #endif // OS_WIN
1275 1268
1276 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1269 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1277 // TODO(ivankr): do this on user login on ChromeOS.
1278 // Init the RLZ library. This just binds the dll and schedules a task on the 1270 // Init the RLZ library. This just binds the dll and schedules a task on the
1279 // file thread to be run sometime later. If this is the first run we record 1271 // file thread to be run sometime later. If this is the first run we record
1280 // the installation event. 1272 // the installation event.
1281 bool is_google_default_search = false;
1282 TemplateURLService* template_url_service =
1283 TemplateURLServiceFactory::GetForProfile(profile_);
1284 if (template_url_service) {
1285 const TemplateURL* url_template =
1286 template_url_service->GetDefaultSearchProvider();
1287 is_google_default_search =
1288 url_template && url_template->url_ref().HasGoogleBaseURLs();
1289 }
1290
1291 PrefService* pref_service = profile_->GetPrefs(); 1273 PrefService* pref_service = profile_->GetPrefs();
1292 bool is_google_homepage = google_util::IsGoogleHomePageUrl(
1293 pref_service->GetString(prefs::kHomePage));
1294
1295 bool is_google_in_startpages = false;
1296 SessionStartupPref session_startup_prefs =
1297 StartupBrowserCreator::GetSessionStartupPref(parsed_command_line(),
1298 profile_);
1299 if (session_startup_prefs.type == SessionStartupPref::URLS) {
1300 is_google_in_startpages = std::count_if(session_startup_prefs.urls.begin(),
1301 session_startup_prefs.urls.end(),
1302 IsGoogleUrl) > 0;
1303 }
1304
1305 int ping_delay = is_first_run_ ? master_prefs_->ping_delay : 1274 int ping_delay = is_first_run_ ? master_prefs_->ping_delay :
1306 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); 1275 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str());
1307 RLZTracker::InitRlzDelayed(is_first_run_, ping_delay, 1276 RLZTracker::InitRlzFromProfileDelayed(profile_, is_first_run_, ping_delay);
1308 is_google_default_search, is_google_homepage,
1309 is_google_in_startpages);
1310
1311 // Prime the RLZ cache for the home page access point so that its avaiable
1312 // for the startup page if needed (i.e., when the startup page is set to
1313 // the home page).
1314 RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL);
1315 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1277 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1316 1278
1317 // Configure modules that need access to resources. 1279 // Configure modules that need access to resources.
1318 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); 1280 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);
1319 1281
1320 // In unittest mode, this will do nothing. In normal mode, this will create 1282 // In unittest mode, this will do nothing. In normal mode, this will create
1321 // the global IntranetRedirectDetector instance, which will promptly go to 1283 // the global IntranetRedirectDetector instance, which will promptly go to
1322 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards 1284 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards
1323 // to see if it should do anything else. 1285 // to see if it should do anything else.
1324 // 1286 //
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 if (base::win::GetVersion() <= base::win::VERSION_XP) 1681 if (base::win::GetVersion() <= base::win::VERSION_XP)
1720 uma_name += "_XP"; 1682 uma_name += "_XP";
1721 1683
1722 uma_name += "_PreRead_"; 1684 uma_name += "_PreRead_";
1723 uma_name += pre_read_percentage; 1685 uma_name += pre_read_percentage;
1724 AddPreReadHistogramTime(uma_name.c_str(), time); 1686 AddPreReadHistogramTime(uma_name.c_str(), time);
1725 } 1687 }
1726 #endif 1688 #endif
1727 #endif 1689 #endif
1728 } 1690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698