summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 21:40:55 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 21:40:55 +0000
commit05e789d0a4728cf8cd2c153443d78992c624a945 (patch)
tree333067a9e46a1c27f8330ad2607ed02ac7db2a37 /chrome
parent48ca901238509dd4c5f7bb30c66ef36f5dafc828 (diff)
downloadchromium_src-05e789d0a4728cf8cd2c153443d78992c624a945.zip
chromium_src-05e789d0a4728cf8cd2c153443d78992c624a945.tar.gz
chromium_src-05e789d0a4728cf8cd2c153443d78992c624a945.tar.bz2
Do not import homepage on First Run if a homepage is given in master preferences.
BUG=9048 Review URL: http://codereview.chromium.org/164291 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_main.cc7
-rw-r--r--chrome/browser/first_run.h9
-rw-r--r--chrome/browser/first_run_gtk.cc3
-rw-r--r--chrome/browser/first_run_mac.mm4
-rw-r--r--chrome/browser/first_run_win.cc9
-rw-r--r--chrome/browser/views/first_run_customize_view.cc5
-rw-r--r--chrome/browser/views/first_run_customize_view.h5
-rw-r--r--chrome/browser/views/first_run_view.cc7
-rw-r--r--chrome/browser/views/first_run_view.h4
-rw-r--r--chrome/browser/views/first_run_view_base.cc12
-rw-r--r--chrome/browser/views/first_run_view_base.h7
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc3
-rw-r--r--chrome/common/temp_scaffolding_stubs.h2
13 files changed, 49 insertions, 28 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 906ee5b..560fc54 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -448,15 +448,14 @@ int BrowserMain(const MainFunctionParams& parameters) {
BrowserInit browser_init;
int rlz_ping_delay = 0;
+ bool homepage_defined = false;
if (is_first_run) {
// On first run, we need to process the master preferences before the
// browser's profile_manager object is created, but after ResourceBundle
// is initialized.
std::vector<std::wstring> first_run_tabs;
first_run_ui_bypass = !FirstRun::ProcessMasterPreferences(user_data_dir,
- FilePath(),
- &first_run_tabs,
- &rlz_ping_delay);
+ FilePath(), &first_run_tabs, &rlz_ping_delay, &homepage_defined);
// The master prefs might specify a set of urls to display.
if (first_run_tabs.size())
AddFirstRunNewTabs(&browser_init, first_run_tabs);
@@ -607,7 +606,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
// preferences are registered, since some of the code that the importer
// touches reads preferences.
if (is_first_run && !first_run_ui_bypass) {
- if (!OpenFirstRunDialog(profile, &process_singleton)) {
+ if (!OpenFirstRunDialog(profile, homepage_defined, &process_singleton)) {
// The user cancelled the first run dialog box, we should exit Chrome.
return ResultCodes::NORMAL_EXIT;
}
diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h
index 0914e9f..41aba0c 100644
--- a/chrome/browser/first_run.h
+++ b/chrome/browser/first_run.h
@@ -70,7 +70,8 @@ class FirstRun {
static bool ProcessMasterPreferences(const FilePath& user_data_dir,
const FilePath& master_prefs_path,
std::vector<std::wstring>* new_tabs,
- int* ping_delay);
+ int* ping_delay,
+ bool* homepage_defined);
// Sets the kShouldShowFirstRunBubble local state pref so that the browser
// shows the bubble once the main message loop gets going. Returns false if
@@ -148,8 +149,12 @@ class FirstRunBrowserProcess : public BrowserProcessImpl {
// |profile| and perhaps some other tasks.
// |process_singleton| is used to lock the handling of CopyData messages
// while the First Run UI is visible.
+// |homepage_defined| true indicates that homepage is defined in master
+// preferences and should not be imported from another browser.
// Returns true if the user clicked "Start", false if the user pressed "Cancel"
// or closed the dialog.
-bool OpenFirstRunDialog(Profile* profile, ProcessSingleton* process_singleton);
+bool OpenFirstRunDialog(Profile* profile,
+ bool homepage_defined,
+ ProcessSingleton* process_singleton);
#endif // CHROME_BROWSER_FIRST_RUN_H_
diff --git a/chrome/browser/first_run_gtk.cc b/chrome/browser/first_run_gtk.cc
index 314a462..dcd6074 100644
--- a/chrome/browser/first_run_gtk.cc
+++ b/chrome/browser/first_run_gtk.cc
@@ -7,7 +7,8 @@
#include "chrome/browser/gtk/first_run_dialog.h"
-bool OpenFirstRunDialog(Profile* profile, ProcessSingleton* process_singleton) {
+bool OpenFirstRunDialog(Profile* profile, bool homepage_defined,
+ ProcessSingleton* process_singleton) {
// TODO(port): Use process_singleton to make sure Chrome can not be started
// while this process is active.
return FirstRunDialog::Show(profile);
diff --git a/chrome/browser/first_run_mac.mm b/chrome/browser/first_run_mac.mm
index cb354d4..808b79c 100644
--- a/chrome/browser/first_run_mac.mm
+++ b/chrome/browser/first_run_mac.mm
@@ -61,7 +61,9 @@ class FirstRunController : public ImportObserver {
};
-bool OpenFirstRunDialog(Profile* profile, ProcessSingleton* process_singleton) {
+bool OpenFirstRunDialog(Profile* profile,
+ bool homepage_defined,
+ ProcessSingleton* process_singleton) {
// OpenFirstRunDialog is a no-op on non-branded builds.
FirstRunController* controller = new FirstRunController;
return controller->DoFirstRun(profile, process_singleton);
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 994fa71..403f5ad 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -168,7 +168,8 @@ bool FirstRun::CreateChromeQuickLaunchShortcut() {
bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
const FilePath& master_prefs_path,
std::vector<std::wstring>* new_tabs,
- int* ping_delay) {
+ int* ping_delay,
+ bool* homepage_defined) {
DCHECK(!user_data_dir.empty());
FilePath master_prefs = master_prefs_path;
if (master_prefs.empty()) {
@@ -194,6 +195,8 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
*ping_delay = 90;
}
}
+ if (homepage_defined)
+ prefs->GetBoolean(prefs::kHomePage, homepage_defined);
if (installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kRequireEula)) {
@@ -351,13 +354,15 @@ bool Upgrade::SwapNewChromeExeIfPresent() {
}
bool OpenFirstRunDialog(Profile* profile,
+ bool homepage_defined,
ProcessSingleton* process_singleton) {
DCHECK(profile);
DCHECK(process_singleton);
// We need the FirstRunView to outlive its parent, as we retrieve the accept
// state from it after the dialog has been closed.
- scoped_ptr<FirstRunView> first_run_view(new FirstRunView(profile));
+ scoped_ptr<FirstRunView> first_run_view(new FirstRunView(profile,
+ homepage_defined));
first_run_view->SetParentOwned(false);
views::Window* first_run_ui = views::Window::CreateChromeWindow(
NULL, gfx::Rect(), first_run_view.get());
diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc
index a61d124..f93d7a7 100644
--- a/chrome/browser/views/first_run_customize_view.cc
+++ b/chrome/browser/views/first_run_customize_view.cc
@@ -24,8 +24,9 @@
FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile,
ImporterHost* importer_host,
CustomizeViewObserver* observer,
- bool default_browser_checked)
- : FirstRunViewBase(profile),
+ bool default_browser_checked,
+ bool homepage_defined)
+ : FirstRunViewBase(profile, homepage_defined),
main_label_(NULL),
import_cbox_(NULL),
import_from_combo_(NULL),
diff --git a/chrome/browser/views/first_run_customize_view.h b/chrome/browser/views/first_run_customize_view.h
index 13ef358..990bf27 100644
--- a/chrome/browser/views/first_run_customize_view.h
+++ b/chrome/browser/views/first_run_customize_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -39,7 +39,8 @@ class FirstRunCustomizeView : public FirstRunViewBase,
FirstRunCustomizeView(Profile* profile,
ImporterHost* importer_host,
CustomizeViewObserver* observer,
- bool default_browser_checked);
+ bool default_browser_checked,
+ bool homepage_defined);
virtual ~FirstRunCustomizeView();
// Overridden from views::View.
diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc
index 1c28b3f..334213c 100644
--- a/chrome/browser/views/first_run_view.cc
+++ b/chrome/browser/views/first_run_view.cc
@@ -33,8 +33,8 @@ std::wstring AddBullet(const std::wstring& text) {
} // namespace
-FirstRunView::FirstRunView(Profile* profile)
- : FirstRunViewBase(profile),
+FirstRunView::FirstRunView(Profile* profile, bool homepage_defined)
+ : FirstRunViewBase(profile, homepage_defined),
welcome_label_(NULL),
actions_label_(NULL),
actions_import_(NULL),
@@ -153,7 +153,8 @@ void FirstRunView::OpenCustomizeDialog() {
new FirstRunCustomizeView(profile_,
importer_host_,
this,
- default_browser_->checked()))->Show();
+ default_browser_->checked(),
+ homepage_defined_))->Show();
}
void FirstRunView::LinkActivated(views::Link* source, int event_flags) {
diff --git a/chrome/browser/views/first_run_view.h b/chrome/browser/views/first_run_view.h
index abc2d48..0f03203 100644
--- a/chrome/browser/views/first_run_view.h
+++ b/chrome/browser/views/first_run_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,7 +25,7 @@ class FirstRunView : public FirstRunViewBase,
public views::LinkController,
public FirstRunCustomizeView::CustomizeViewObserver {
public:
- explicit FirstRunView(Profile* profile);
+ explicit FirstRunView(Profile* profile, bool homepage_defined);
virtual ~FirstRunView();
bool accepted() const { return accepted_;}
diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc
index afb73f0..4d420e0 100644
--- a/chrome/browser/views/first_run_view_base.cc
+++ b/chrome/browser/views/first_run_view_base.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,14 +30,15 @@
#include "views/window/client_view.h"
#include "views/window/window.h"
-FirstRunViewBase::FirstRunViewBase(Profile* profile)
+FirstRunViewBase::FirstRunViewBase(Profile* profile, bool homepage_defined)
: preferred_width_(0),
background_image_(NULL),
separator_1_(NULL),
default_browser_(NULL),
separator_2_(NULL),
importer_host_(NULL),
- profile_(profile) {
+ profile_(profile),
+ homepage_defined_(homepage_defined) {
DCHECK(profile);
SetupControls();
}
@@ -163,7 +164,10 @@ int FirstRunViewBase::GetDefaultImportItems() const {
// It is best to avoid importing cookies because there is a bug that make
// the process take way too much time among other issues. So for the time
// being we say: TODO(CPU): Bug 1196875
- return HISTORY | FAVORITES | PASSWORDS | SEARCH_ENGINES | HOME_PAGE;
+ int items = HISTORY | FAVORITES | PASSWORDS | SEARCH_ENGINES;
+ if (!homepage_defined_)
+ items = items | HOME_PAGE;
+ return items;
};
void FirstRunViewBase::DisableButtons() {
diff --git a/chrome/browser/views/first_run_view_base.h b/chrome/browser/views/first_run_view_base.h
index 2e19947..77db891 100644
--- a/chrome/browser/views/first_run_view_base.h
+++ b/chrome/browser/views/first_run_view_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,7 +26,7 @@ class ImporterHost;
class FirstRunViewBase : public views::View,
public views::DialogDelegate {
public:
- explicit FirstRunViewBase(Profile* profile);
+ explicit FirstRunViewBase(Profile* profile, bool homepage_defined);
virtual ~FirstRunViewBase();
// Overridden from views::View.
@@ -79,6 +79,9 @@ class FirstRunViewBase : public views::View,
Profile* profile_;
views::Checkbox* default_browser_;
+ protected:
+ bool homepage_defined_;
+
private:
// Initializes the controls on the dialog.
void SetupControls();
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index b1d6f40..cf0f4b2 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -146,7 +146,8 @@ void AutomationProvider::OnMessageFromExternalHost(
bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
const FilePath& master_prefs_path,
std::vector<std::wstring>* new_tabs,
- int* ping_delay) {
+ int* ping_delay,
+ bool* homepage_defined) {
// http://code.google.com/p/chromium/issues/detail?id=11971
// Pretend we processed them correctly.
return true;
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 0158700..1e681eb 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -52,8 +52,6 @@ class Message;
//---------------------------------------------------------------------------
// These stubs are for Browser_main()
-bool OpenFirstRunDialog(Profile* profile, ProcessSingleton* process_singleton);
-
void InstallJankometer(const CommandLine&);
//---------------------------------------------------------------------------