summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-16 22:00:02 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-16 22:00:02 +0000
commitb09219ce1c3cc989179eceb15da8ac44a48cf210 (patch)
tree090679a0bc50a59307a1c9a7fc2b1ff98dd06a83 /chrome/browser
parent2ca113a46d9d8fe80324f1cce0c28c5142b7441a (diff)
downloadchromium_src-b09219ce1c3cc989179eceb15da8ac44a48cf210.zip
chromium_src-b09219ce1c3cc989179eceb15da8ac44a48cf210.tar.gz
chromium_src-b09219ce1c3cc989179eceb15da8ac44a48cf210.tar.bz2
Revert the first run bubble change because of Mac/Linux failures.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser.cc5
-rw-r--r--chrome/browser/first_run.cc15
-rw-r--r--chrome/browser/first_run.h5
-rw-r--r--chrome/browser/location_bar.h2
-rw-r--r--chrome/browser/views/first_run_bubble.cc150
-rw-r--r--chrome/browser/views/first_run_bubble.h9
-rw-r--r--chrome/browser/views/location_bar_view.cc8
-rw-r--r--chrome/browser/views/location_bar_view.h4
8 files changed, 24 insertions, 174 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d6a51ab..13ca661 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -284,12 +284,9 @@ void Browser::CreateBrowserWindow() {
return;
if (local_state->IsPrefRegistered(prefs::kShouldShowFirstRunBubble) &&
local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) {
- bool show_OEM_bubble = (local_state->
- IsPrefRegistered(prefs::kShouldUseOEMFirstRunBubble) &&
- local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble));
// Reset the preference so we don't show the bubble for subsequent windows.
local_state->ClearPref(prefs::kShouldShowFirstRunBubble);
- window_->GetLocationBar()->ShowFirstRunBubble(show_OEM_bubble);
+ window_->GetLocationBar()->ShowFirstRunBubble();
}
FindBar* find_bar = BrowserWindow::CreateFindBar(this);
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc
index 3a24488..7dbb3df 100644
--- a/chrome/browser/first_run.cc
+++ b/chrome/browser/first_run.cc
@@ -266,9 +266,6 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
}
}
- if (parse_result & installer_util::MASTER_PROFILE_OEM_FIRST_RUN_BUBBLE)
- FirstRun::SetOEMFirstRunBubblePref();
-
FilePath user_prefs = FilePath::FromWStringHack(
GetDefaultPrefFilePath(true, user_data_dir.ToWStringHack()));
if (user_prefs.empty())
@@ -643,18 +640,6 @@ bool FirstRun::SetShowFirstRunBubblePref() {
return true;
}
-bool FirstRun::SetOEMFirstRunBubblePref() {
- PrefService* local_state = g_browser_process->local_state();
- if (!local_state)
- return false;
- if (!local_state->IsPrefRegistered(prefs::kShouldUseOEMFirstRunBubble)) {
- local_state->RegisterBooleanPref(prefs::kShouldUseOEMFirstRunBubble,
- false);
- local_state->SetBoolean(prefs::kShouldUseOEMFirstRunBubble, true);
- }
- return true;
-}
-
bool FirstRun::SetShowWelcomePagePref() {
PrefService* local_state = g_browser_process->local_state();
if (!local_state)
diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h
index 737cd00..d11e0b4 100644
--- a/chrome/browser/first_run.h
+++ b/chrome/browser/first_run.h
@@ -76,11 +76,6 @@ class FirstRun {
// the pref could not be set.
static bool SetShowFirstRunBubblePref();
- // Sets the kShouldUseOEMFirstRunBubble local state pref so that the
- // browser shows the OEM first run bubble once the main message loop
- // gets going. Returns false if the pref could not be set.
- static bool SetOEMFirstRunBubblePref();
-
// Sets the kShouldShowWelcomePage local state pref so that the browser
// loads the welcome tab once the message loop gets going. Returns false
// if the pref could not be set.
diff --git a/chrome/browser/location_bar.h b/chrome/browser/location_bar.h
index 218f65c..70a06d5 100644
--- a/chrome/browser/location_bar.h
+++ b/chrome/browser/location_bar.h
@@ -22,7 +22,7 @@ class TabContents;
class LocationBar {
public:
// Shows the first run information bubble anchored to the location bar.
- virtual void ShowFirstRunBubble(bool use_OEM_bubble) = 0;
+ virtual void ShowFirstRunBubble() = 0;
// Returns the string of text entered in the location bar.
virtual std::wstring GetInputString() const = 0;
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc
index df5000e..0ca491c 100644
--- a/chrome/browser/views/first_run_bubble.cc
+++ b/chrome/browser/views/first_run_bubble.cc
@@ -16,10 +16,8 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
-#include "grit/theme_resources.h"
#include "views/event.h"
#include "views/controls/button/native_button.h"
-#include "views/controls/button/image_button.h"
#include "views/controls/label.h"
#include "views/focus/focus_manager.h"
#include "views/standard_layout.h"
@@ -31,17 +29,6 @@ namespace {
// provides.
static const int kBubblePadding = 4;
-// How much extra padding to put around our content over what the InfoBubble
-// provides in alternative OEM bubble.
-static const int kOEMBubblePadding = 4;
-
-// Padding between parts of strings on the same line (for instance,
-// "New!" and "Search from the address bar!"
-static const int kStringSeparationPadding = 2;
-
-// Margin around close button.
-static const int kMarginRightOfCloseButton = 7;
-
std::wstring GetDefaultSearchEngineName(Profile* profile) {
if (!profile) {
NOTREACHED();
@@ -60,18 +47,11 @@ std::wstring GetDefaultSearchEngineName(Profile* profile) {
} // namespace
-// Base class for implementations of the client view which appears inside the
-// first run bubble. It is a dialog-ish view, but is not a true dialog.
-class FirstRunBubbleViewBase : public views::View,
- public views::ButtonListener,
- public views::FocusChangeListener {
- public:
- // Called by FirstRunBubble::Show to request focus for the proper button
- // in the FirstRunBubbleView when it is shown.
- virtual void BubbleShown() = 0;
-};
-
-class FirstRunBubbleView : public FirstRunBubbleViewBase {
+// Implements the client view inside the first run bubble. It is kind of a
+// dialog-ish view, but is not a true dialog.
+class FirstRunBubbleView : public views::View,
+ public views::ButtonListener,
+ public views::FocusChangeListener {
public:
FirstRunBubbleView(FirstRunBubble* bubble_window, Profile* profile)
: bubble_window_(bubble_window),
@@ -123,6 +103,7 @@ class FirstRunBubbleView : public FirstRunBubbleViewBase {
keep_button_->RequestFocus();
}
+ // Overridden from ButtonListener.
virtual void ButtonPressed(views::Button* sender) {
bubble_window_->Close();
if (change_button_ == sender) {
@@ -134,6 +115,7 @@ class FirstRunBubbleView : public FirstRunBubbleViewBase {
}
}
+ // Overridden from views::View.
virtual void Layout() {
gfx::Size canvas = GetPreferredSize();
@@ -175,6 +157,7 @@ class FirstRunBubbleView : public FirstRunBubbleViewBase {
pref_size.width(), pref_size.height());
}
+ // Overridden from views::View.
virtual gfx::Size GetPreferredSize() {
return gfx::Size(views::Window::GetLocalizedContentsSize(
IDS_FIRSTRUNBUBBLE_DIALOG_WIDTH_CHARS,
@@ -207,111 +190,6 @@ class FirstRunBubbleView : public FirstRunBubbleViewBase {
DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleView);
};
-class FirstRunOEMBubbleView : public FirstRunBubbleViewBase {
- public:
- FirstRunOEMBubbleView(FirstRunBubble* bubble_window, Profile* profile)
- : bubble_window_(bubble_window),
- label1_(NULL),
- label2_(NULL),
- label3_(NULL),
- close_button_(NULL) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont);
-
- label1_ = new views::Label(
- l10n_util::GetString(IDS_FR_OEM_BUBBLE_TITLE_1));
- label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD));
- label1_->SetColor(SK_ColorRED);
- label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- AddChildView(label1_);
-
- label2_ = new views::Label(
- l10n_util::GetString(IDS_FR_OEM_BUBBLE_TITLE_2));
- label2_->SetFont(font.DeriveFont(3, gfx::Font::BOLD));
- label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- AddChildView(label2_);
-
- gfx::Size ps = GetPreferredSize();
-
- label3_ = new views::Label(
- l10n_util::GetString(IDS_FR_OEM_BUBBLE_SUBTEXT));
- label3_->SetMultiLine(true);
- label3_->SetFont(font);
- label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- label3_->SizeToFit(ps.width() - kOEMBubblePadding * 2);
- AddChildView(label3_);
-
- close_button_ = new views::ImageButton(this);
- close_button_->SetImage(views::CustomButton::BS_NORMAL,
- rb.GetBitmapNamed(IDR_CLOSE_BAR));
- close_button_->SetImage(views::CustomButton::BS_HOT,
- rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
- close_button_->SetImage(views::CustomButton::BS_PUSHED,
- rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
-
- AddChildView(close_button_);
- }
-
- void BubbleShown() {
- // No button in oem_bubble to request focus.
- }
-
- virtual void ButtonPressed(views::Button* sender) {
- bubble_window_->Close();
- }
-
- virtual void Layout() {
- gfx::Size canvas = GetPreferredSize();
-
- // First, draw the close button on the far right.
- gfx::Size sz = close_button_->GetPreferredSize();
- close_button_->SetBounds(canvas.width() - sz.width() -
- kMarginRightOfCloseButton,
- kOEMBubblePadding,
- sz.width(),
- sz.height());
-
- gfx::Size pref_size = label1_->GetPreferredSize();
- label1_->SetBounds(kOEMBubblePadding, kOEMBubblePadding,
- pref_size.width() + kOEMBubblePadding * 2,
- pref_size.height());
-
- pref_size = label2_->GetPreferredSize();
- label2_->SetBounds(kOEMBubblePadding * 2 + label1_->
- GetPreferredSize().width(),
- kOEMBubblePadding,
- canvas.width() - kOEMBubblePadding * 2,
- pref_size.height());
-
- int next_v_space = label1_->y() + pref_size.height() +
- kRelatedControlSmallVerticalSpacing;
-
- pref_size = label3_->GetPreferredSize();
- label3_->SetBounds(kOEMBubblePadding, next_v_space,
- canvas.width() - kOEMBubblePadding * 2,
- pref_size.height());
- }
-
- virtual gfx::Size GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
- IDS_FIRSTRUNOEMBUBBLE_DIALOG_WIDTH_CHARS,
- IDS_FIRSTRUNOEMBUBBLE_DIALOG_HEIGHT_LINES));
- }
-
- virtual void FocusWillChange(View* focused_before, View* focused_now) {
- // No buttons in oem_bubble to register focus changes.
- }
-
- private:
- FirstRunBubble* bubble_window_;
- views::Label* label1_;
- views::Label* label2_;
- views::Label* label3_;
- views::ImageButton* close_button_;
-
- DISALLOW_COPY_AND_ASSIGN(FirstRunOEMBubbleView);
-};
-
// Keep the bubble around for kLingerTime milliseconds, to prevent accidental
// closure.
static const int kLingerTime = 1000;
@@ -323,6 +201,8 @@ void FirstRunBubble::OnActivate(UINT action, BOOL minimized, HWND window) {
if (action == WA_ACTIVE && !has_been_activated_) {
has_been_activated_ = true;
+ // Disable the browser to prevent accidental rapid clicks from closing the
+ // bubble.
::EnableWindow(GetParent(), false);
MessageLoop::current()->PostDelayedTask(FROM_HERE,
@@ -330,7 +210,6 @@ void FirstRunBubble::OnActivate(UINT action, BOOL minimized, HWND window) {
&FirstRunBubble::EnableParent),
kLingerTime);
}
-
InfoBubble::OnActivate(action, minimized, window);
}
@@ -347,14 +226,9 @@ void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble,
// static
FirstRunBubble* FirstRunBubble::Show(Profile* profile, HWND parent_hwnd,
- const gfx::Rect& position_relative_to,
- bool use_OEM_bubble) {
+ const gfx::Rect& position_relative_to) {
FirstRunBubble* window = new FirstRunBubble();
- FirstRunBubbleViewBase* view = NULL;
- if (use_OEM_bubble)
- view = new FirstRunOEMBubbleView(window, profile);
- else
- view = new FirstRunBubbleView(window, profile);
+ FirstRunBubbleView* view = new FirstRunBubbleView(window, profile);
window->SetDelegate(window);
window->set_view(view);
window->Init(parent_hwnd, position_relative_to, view);
diff --git a/chrome/browser/views/first_run_bubble.h b/chrome/browser/views/first_run_bubble.h
index 598362b..d921987 100644
--- a/chrome/browser/views/first_run_bubble.h
+++ b/chrome/browser/views/first_run_bubble.h
@@ -8,15 +8,14 @@
#include "base/task.h"
#include "chrome/browser/views/info_bubble.h"
-class FirstRunBubbleViewBase;
+class FirstRunBubbleView;
class Profile;
class FirstRunBubble : public InfoBubble,
public InfoBubbleDelegate {
public:
static FirstRunBubble* Show(Profile* profile, HWND parent_hwnd,
- const gfx::Rect& position_relative_to,
- bool use_OEM_bubble);
+ const gfx::Rect& position_relative_to);
FirstRunBubble()
: enable_window_method_factory_(this),
@@ -30,7 +29,7 @@ class FirstRunBubble : public InfoBubble,
enable_window_method_factory_.RevokeAll();
}
- void set_view(FirstRunBubbleViewBase* view) { view_ = view; }
+ void set_view(FirstRunBubbleView* view) { view_ = view; }
// Overridden from InfoBubble:
virtual void OnActivate(UINT action, BOOL minimized, HWND window);
@@ -50,7 +49,7 @@ class FirstRunBubble : public InfoBubble,
ScopedRunnableMethodFactory<FirstRunBubble> enable_window_method_factory_;
// The view inside the FirstRunBubble.
- FirstRunBubbleViewBase* view_;
+ FirstRunBubbleView* view_;
DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
};
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 83c23c9..415334e 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -936,7 +936,7 @@ void LocationBarView::ShowInfoBubbleTask::Cancel() {
// -----------------------------------------------------------------------------
-void LocationBarView::ShowFirstRunBubbleInternal(bool use_OEM_bubble) {
+void LocationBarView::ShowFirstRunBubbleInternal() {
if (!location_entry_view_)
return;
if (!location_entry_view_->GetWidget()->IsActive()) {
@@ -965,7 +965,7 @@ void LocationBarView::ShowFirstRunBubbleInternal(bool use_OEM_bubble) {
FirstRunBubble::Show(profile_,
location_entry_view_->GetRootView()->GetWidget()->GetNativeView(),
- bounds, use_OEM_bubble);
+ bounds);
}
// LocationBarImageView---------------------------------------------------------
@@ -1169,10 +1169,10 @@ bool LocationBarView::OverrideAccelerator(
////////////////////////////////////////////////////////////////////////////////
// LocationBarView, LocationBar implementation:
-void LocationBarView::ShowFirstRunBubble(bool use_OEM_bubble) {
+void LocationBarView::ShowFirstRunBubble() {
// We wait 30 milliseconds to open. It allows less flicker.
Task* task = first_run_bubble_.NewRunnableMethod(
- &LocationBarView::ShowFirstRunBubbleInternal, use_OEM_bubble);
+ &LocationBarView::ShowFirstRunBubbleInternal);
MessageLoop::current()->PostDelayedTask(FROM_HERE, task, 30);
}
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index e81c5fc..b0648d7 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -111,7 +111,7 @@ class LocationBarView : public LocationBar,
virtual bool OverrideAccelerator(const views::Accelerator& accelerator);
// Overridden from LocationBar:
- virtual void ShowFirstRunBubble(bool use_OEM_bubble);
+ virtual void ShowFirstRunBubble();
virtual std::wstring GetInputString() const;
virtual WindowOpenDisposition GetWindowOpenDisposition() const;
virtual PageTransition::Type GetPageTransition() const;
@@ -416,7 +416,7 @@ class LocationBarView : public LocationBar,
void OnMouseEvent(const views::MouseEvent& event, UINT msg);
// Helper to show the first run info bubble.
- void ShowFirstRunBubbleInternal(bool use_OEM_bubble);
+ void ShowFirstRunBubbleInternal();
// Current profile. Not owned by us.
Profile* profile_;