summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/app/theme/theme_resources.grd1
-rw-r--r--chrome/browser/chromeos/login/background_view.cc109
-rw-r--r--chrome/browser/chromeos/login/background_view.h40
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc7
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.h13
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc63
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc1
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--views/controls/button/text_button.cc15
-rw-r--r--views/controls/button/text_button.h7
11 files changed, 163 insertions, 98 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 77535d3..169cfe0 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8975,9 +8975,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_GO_INCOGNITO_BUTTON">
Go incognito
</message>
- <message name="IDS_SHUTDOWN_BUTTON" desc="Text shown on shutdown button on login/locker screen">
- Shutdown
- </message>
<message name="IDS_LOGIN_OOBE_HELP_DIALOG_TITLE" desc="Default title for help dialogs during OOBE/login">
Help
</message>
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 6a8c38e..036cd7c 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -577,7 +577,6 @@
<include name="IDR_SCROLL_THUMB" file="chromeos_scroll_thumb.png" type="BINDATA" />
<include name="IDR_SCROLL_THUMB_H" file="chromeos_scroll_thumb_h.png" type="BINDATA" />
<include name="IDR_SCROLL_THUMB_P" file="chromeos_scroll_thumb_p.png" type="BINDATA" />
- <include name="IDR_SHUTDOWN_ICON" file="shutdown_icon.png" type="BINDATA" />
</if>
</includes>
</release>
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc
index fe5cb66..79d1a9c 100644
--- a/chrome/browser/chromeos/login/background_view.cc
+++ b/chrome/browser/chromeos/login/background_view.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/oobe_progress_bar.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
-#include "chrome/browser/chromeos/login/shutdown_button.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/status/clock_menu_button.h"
#include "chrome/browser/chromeos/status/feedback_menu_button.h"
@@ -95,8 +94,9 @@ BackgroundView::BackgroundView()
os_version_label_(NULL),
boot_times_label_(NULL),
progress_bar_(NULL),
- shutdown_button_(NULL),
+ go_incognito_button_(NULL),
did_paint_(false),
+ delegate_(NULL),
#if defined(OFFICIAL_BUILD)
is_official_build_(true),
#else
@@ -120,13 +120,6 @@ void BackgroundView::Init(const GURL& background_url) {
}
}
-void BackgroundView::EnableShutdownButton() {
- DCHECK(!shutdown_button_);
- shutdown_button_ = new ShutdownButton();
- shutdown_button_->Init();
- AddChildView(shutdown_button_);
-}
-
// static
views::Widget* BackgroundView::CreateWindowContainingView(
const gfx::Rect& bounds,
@@ -175,6 +168,21 @@ void BackgroundView::SetOobeProgress(LoginStep step) {
progress_bar_->SetProgress(step);
}
+// Toggles GoIncognito button visibility.
+void BackgroundView::SetGoIncognitoButtonVisible(bool visible,
+ Delegate *delegate) {
+ // Set delegate to handle button pressing.
+ delegate_ = delegate;
+ bool currently_visible =
+ go_incognito_button_ && go_incognito_button_->IsVisible();
+ if (currently_visible != visible) {
+ if (!go_incognito_button_) {
+ InitGoIncognitoButton();
+ }
+ go_incognito_button_->SetVisible(visible);
+ }
+}
+
void BackgroundView::ShowScreenSaver() {
SetStatusAreaVisible(false);
background_area_->SetVisible(true);
@@ -195,6 +203,17 @@ bool BackgroundView::ScreenSaverEnabled() {
return background_area_ != NULL;
}
+void BackgroundView::OnOwnerChanged() {
+ delegate_ = NULL;
+ if (go_incognito_button_) {
+ // BackgroundView is passed among multiple controllers, so they should
+ // explicitly enable "Go incognito" button if needed.
+ RemoveChildView(go_incognito_button_);
+ delete go_incognito_button_;
+ go_incognito_button_ = NULL;
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// BackgroundView protected:
@@ -214,6 +233,8 @@ void BackgroundView::Layout() {
const int kProgressBarBottomPadding = 20;
const int kProgressBarWidth = 750;
const int kProgressBarHeight = 70;
+ const int kGoIncognitoButtonBottomPadding = 12;
+ const int kGoIncognitoButtonRightPadding = 12;
gfx::Size status_area_size = status_area_->GetPreferredSize();
status_area_->SetBounds(
width() - status_area_size.width() - kCornerPadding,
@@ -243,8 +264,13 @@ void BackgroundView::Layout() {
kProgressBarWidth,
kProgressBarHeight);
}
- if (shutdown_button_) {
- shutdown_button_->LayoutIn(this);
+ if (go_incognito_button_) {
+ gfx::Size go_button_size = go_incognito_button_->GetPreferredSize();
+ go_incognito_button_->SetBounds(
+ width() - go_button_size.width()- kGoIncognitoButtonRightPadding,
+ height() - go_button_size.height() - kGoIncognitoButtonBottomPadding,
+ go_button_size.width(),
+ go_button_size.height());
}
if (background_area_)
background_area_->SetBounds(this->bounds());
@@ -255,6 +281,12 @@ void BackgroundView::ChildPreferredSizeChanged(View* child) {
SchedulePaint();
}
+void BackgroundView::OnLocaleChanged() {
+ UpdateLocalizedStrings();
+ Layout();
+ SchedulePaint();
+}
+
gfx::NativeWindow BackgroundView::GetNativeWindow() const {
return
GTK_WINDOW(static_cast<WidgetGtk*>(GetWidget())->GetNativeView());
@@ -283,6 +315,16 @@ bool BackgroundView::IsScreenLockerMode() const {
return false;
}
+void BackgroundView::ButtonPressed(views::Button* sender,
+ const views::Event& event) {
+ if (sender == go_incognito_button_) {
+ DCHECK(delegate_);
+ if (delegate_) {
+ delegate_->OnGoIncognitoButton();
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// BackgroundView private:
@@ -343,6 +385,51 @@ void BackgroundView::InitProgressBar() {
AddChildView(progress_bar_);
}
+void BackgroundView::InitGoIncognitoButton() {
+ SkColor kButtonColor = 0xFF4F6985;
+ SkColor kStrokeColor = 0xFF657A91;
+ int kStrokeWidth = 1;
+ int kVerticalPadding = 8;
+ int kHorizontalPadding = 12;
+ int kCornerRadius = 4;
+
+ go_incognito_button_ =
+ new TextButtonWithHandCursorOver(this, std::wstring());
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ go_incognito_button_->SetIcon(*rb.GetBitmapNamed(IDR_INCOGNITO_GUY));
+ go_incognito_button_->SetFocusable(true);
+ // Set label colors.
+ go_incognito_button_->SetEnabledColor(SK_ColorWHITE);
+ go_incognito_button_->SetDisabledColor(SK_ColorWHITE);
+ go_incognito_button_->SetHighlightColor(SK_ColorWHITE);
+ go_incognito_button_->SetHoverColor(SK_ColorWHITE);
+ // Disable throbbing and make border always visible.
+ go_incognito_button_->SetAnimationDuration(0);
+ go_incognito_button_->SetNormalHasBorder(true);
+ // Setup round shapes.
+ go_incognito_button_->set_background(
+ CreateRoundedBackground(
+ kCornerRadius, kStrokeWidth, kButtonColor, kStrokeColor));
+
+ go_incognito_button_->set_border(
+ views::Border::CreateEmptyBorder(kVerticalPadding,
+ kHorizontalPadding,
+ kVerticalPadding,
+ kHorizontalPadding));
+ // Set button text.
+ UpdateLocalizedStrings();
+ // Enable and add to the views hierarchy.
+ go_incognito_button_->SetEnabled(true);
+ AddChildView(go_incognito_button_);
+}
+
+void BackgroundView::UpdateLocalizedStrings() {
+ if (go_incognito_button_) {
+ go_incognito_button_->SetText(
+ UTF8ToWide(l10n_util::GetStringUTF8(IDS_GO_INCOGNITO_BUTTON)));
+ }
+}
+
void BackgroundView::UpdateWindowType() {
std::vector<int> params;
params.push_back(did_paint_ ? 1 : 0);
diff --git a/chrome/browser/chromeos/login/background_view.h b/chrome/browser/chromeos/login/background_view.h
index 04da51f..e64caf7 100644
--- a/chrome/browser/chromeos/login/background_view.h
+++ b/chrome/browser/chromeos/login/background_view.h
@@ -10,12 +10,13 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/status/status_area_host.h"
#include "chrome/browser/chromeos/version_loader.h"
+#include "views/controls/button/button.h"
#include "views/view.h"
namespace views {
+class Widget;
class Label;
class TextButton;
-class Widget;
}
class DOMView;
@@ -25,14 +26,23 @@ class Profile;
namespace chromeos {
class OobeProgressBar;
-class ShutdownButton;
class StatusAreaView;
// View used to render the background during login. BackgroundView contains
// StatusAreaView.
class BackgroundView : public views::View,
- public StatusAreaHost {
+ public StatusAreaHost,
+ public views::ButtonListener {
public:
+ // Delegate class to handle notificatoin from the view.
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ // Initializes incognito login.
+ virtual void OnGoIncognitoButton() = 0;
+ };
+
enum LoginStep {
SELECT_NETWORK,
#if defined(OFFICIAL_BUILD)
@@ -51,9 +61,6 @@ class BackgroundView : public views::View,
// it creates a DOMView background area that renders a webpage.
void Init(const GURL& background_url);
- // Enables shutdown button.
- void EnableShutdownButton();
-
// Creates a window containing an instance of WizardContentsView as the root
// view. The caller is responsible for showing (and closing) the returned
// widget. The BackgroundView is set in |view|. If background_url is non
@@ -75,6 +82,9 @@ class BackgroundView : public views::View,
// Sets current step on OOBE progress bar.
void SetOobeProgress(LoginStep step);
+ // Toggles GoIncognito button visibility.
+ void SetGoIncognitoButtonVisible(bool visible, Delegate *delegate);
+
// Shows screen saver.
void ShowScreenSaver();
@@ -87,11 +97,15 @@ class BackgroundView : public views::View,
// Tells if screen saver is enabled.
bool ScreenSaverEnabled();
+ // Tells that owner has been changed.
+ void OnOwnerChanged();
+
protected:
// Overridden from views::View:
virtual void Paint(gfx::Canvas* canvas);
virtual void Layout();
virtual void ChildPreferredSizeChanged(View* child);
+ virtual void OnLocaleChanged();
// Overridden from StatusAreaHost:
virtual Profile* GetProfile() const { return NULL; }
@@ -103,6 +117,9 @@ class BackgroundView : public views::View,
virtual bool IsBrowserMode() const;
virtual bool IsScreenLockerMode() const;
+ // Overridden from views::ButtonListener.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
private:
// Creates and adds the status_area.
void InitStatusArea();
@@ -110,6 +127,11 @@ class BackgroundView : public views::View,
void InitInfoLabels();
// Creates and add OOBE progress bar.
void InitProgressBar();
+ // Creates and add GoIncoginito button.
+ void InitGoIncognitoButton();
+
+ // Updates string from the resources.
+ void UpdateLocalizedStrings();
// Invokes SetWindowType for the window. This is invoked during startup and
// after we've painted.
@@ -126,7 +148,7 @@ class BackgroundView : public views::View,
views::Label* os_version_label_;
views::Label* boot_times_label_;
OobeProgressBar* progress_bar_;
- ShutdownButton* shutdown_button_;
+ views::TextButton* go_incognito_button_;
// Handles asynchronously loading the version.
VersionLoader version_loader_;
@@ -143,6 +165,10 @@ class BackgroundView : public views::View,
// TODO(sky): nuke this when the wm knows when chrome has painted.
bool did_paint_;
+ // NOTE: |delegate_| is assigned to NULL when the owner is changed. See
+ // 'OnOwnerChanged()' for more info.
+ Delegate *delegate_;
+
// True if running official BUILD.
bool is_official_build_;
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 0358874..c7f7b69 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -27,7 +27,6 @@
#include "chrome/browser/chromeos/login/login_utils.h"
#include "chrome/browser/chromeos/login/message_bubble.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
-#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/chromeos/wm_ipc.h"
#include "chrome/browser/views/window.h"
#include "chrome/common/chrome_switches.h"
@@ -158,7 +157,6 @@ void ExistingUserController::Init() {
background_bounds_,
GURL(url_string),
&background_view_);
- background_view_->EnableShutdownButton();
if (!WizardController::IsDeviceRegistered()) {
background_view_->SetOobeProgressBarVisible(true);
@@ -189,6 +187,7 @@ void ExistingUserController::OwnBackground(
DCHECK(!background_window_);
background_window_ = background_widget;
background_view_ = background_view;
+ background_view_->OnOwnerChanged();
}
void ExistingUserController::LoginNewUser(const std::string& username,
@@ -362,6 +361,10 @@ void ExistingUserController::SelectUser(int index) {
}
}
+void ExistingUserController::OnGoIncognitoButton() {
+ LoginOffTheRecord();
+}
+
void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
std::string error = failure.GetErrorString();
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index 080ff9c..766250a 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -27,11 +27,10 @@ namespace chromeos {
class HelpAppLauncher;
class MessageBubble;
-// ExistingUserController is used to handle login when someone has
-// already logged into the machine. When Init is invoked, a
-// UserController is created for each of the Users's in the
-// UserManager (including one for new user and one for Guest login),
-// and the window manager is then told to show the windows.
+// ExistingUserController is used to handle login when someone has already
+// logged into the machine. When Init is invoked a UserController is created for
+// each of the Users's in the UserManager (including one for new user and
+// one for BWSI login), and the window manager is then told to show the windows.
//
// To use ExistingUserController create an instance of it and invoke Init.
//
@@ -39,6 +38,7 @@ class MessageBubble;
// the user logs in (or chooses to see other settings).
class ExistingUserController : public WmMessageListener::Observer,
public UserController::Delegate,
+ public BackgroundView::Delegate,
public LoginPerformer::Delegate,
public MessageBubbleDelegate,
public CaptchaView::Delegate,
@@ -85,6 +85,9 @@ class ExistingUserController : public WmMessageListener::Observer,
virtual void AddStartUrl(const GURL& start_url) { start_url_ = start_url; }
virtual void SelectUser(int index);
+ // BackgroundView::Delegate
+ virtual void OnGoIncognitoButton();
+
// LoginPerformer::Delegate implementation:
virtual void OnLoginFailure(const LoginFailure& error);
virtual void OnLoginSuccess(
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index b934cfe..29b6708 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -29,7 +29,6 @@
#include "chrome/browser/chromeos/login/login_utils.h"
#include "chrome/browser/chromeos/login/message_bubble.h"
#include "chrome/browser/chromeos/login/screen_lock_view.h"
-#include "chrome/browser/chromeos/login/shutdown_button.h"
#include "chrome/browser/chromeos/wm_ipc.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/common/chrome_switches.h"
@@ -224,33 +223,6 @@ class LockWindow : public views::WidgetGtk {
DISALLOW_COPY_AND_ASSIGN(LockWindow);
};
-// GrabWidget's root view to layout the ScreenLockView at the center
-// and the Shutdown button at the right bottom.
-class GrabWidgetRootView : public views::View {
- public:
- explicit GrabWidgetRootView(chromeos::ScreenLockView* screen_lock_view)
- : screen_lock_view_(screen_lock_view),
- shutdown_button_(new chromeos::ShutdownButton()) {
- shutdown_button_->Init();
- AddChildView(screen_lock_view_);
- AddChildView(shutdown_button_);
- }
-
- // views::View implementation.
- virtual void Layout() {
- gfx::Size size = screen_lock_view_->GetPreferredSize();
- screen_lock_view_->SetBounds(0, 0, size.width(), size.height());
- shutdown_button_->LayoutIn(this);
- }
-
- private:
- views::View* screen_lock_view_;
-
- chromeos::ShutdownButton* shutdown_button_;
-
- DISALLOW_COPY_AND_ASSIGN(GrabWidgetRootView);
-};
-
// A child widget that grabs both keyboard and pointer input.
class GrabWidget : public views::WidgetGtk {
public:
@@ -357,10 +329,8 @@ void GrabWidget::TryGrabAllInputs() {
// addition to other background components.
class ScreenLockerBackgroundView : public chromeos::BackgroundView {
public:
- ScreenLockerBackgroundView(views::WidgetGtk* lock_widget,
- views::View* screen_lock_view)
- : lock_widget_(lock_widget),
- screen_lock_view_(screen_lock_view) {
+ explicit ScreenLockerBackgroundView(views::WidgetGtk* lock_widget)
+ : lock_widget_(lock_widget) {
}
virtual bool IsScreenLockerMode() const {
@@ -370,24 +340,17 @@ class ScreenLockerBackgroundView : public chromeos::BackgroundView {
virtual void Layout() {
chromeos::BackgroundView::Layout();
gfx::Rect screen = bounds();
- if (screen_lock_view_) {
- gfx::Size size = screen_lock_view_->GetPreferredSize();
- gfx::Point origin((screen.width() - size.width()) / 2,
- (screen.height() - size.height()) / 2);
- gfx::Size widget_size(screen.size());
- widget_size.Enlarge(-origin.x(), -origin.y());
- lock_widget_->SetBounds(gfx::Rect(origin, widget_size));
- } else {
- // No password entry. Move the lock widget to off screen.
- lock_widget_->SetBounds(gfx::Rect(-100, -100, 1, 1));
- }
+ gfx::Size size = lock_widget_->GetRootView()->GetPreferredSize();
+ lock_widget_->SetBounds(
+ gfx::Rect((screen.width() - size.width()) / 2,
+ (screen.height() - size.height()) / 2,
+ size.width(),
+ size.height()));
}
private:
views::WidgetGtk* lock_widget_;
- views::View* screen_lock_view_;
-
DISALLOW_COPY_AND_ASSIGN(ScreenLockerBackgroundView);
};
@@ -575,19 +538,15 @@ void ScreenLocker::Init() {
lock_widget_ = new GrabWidget(this);
lock_widget_->MakeTransparent();
lock_widget_->InitWithWidget(lock_window_, gfx::Rect());
- if (screen_lock_view_) {
- lock_widget_->SetContentsView(
- new GrabWidgetRootView(screen_lock_view_));
- }
-
+ if (screen_lock_view_)
+ lock_widget_->SetContentsView(screen_lock_view_);
lock_widget_->Show();
// Configuring the background url.
std::string url_string =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kScreenSaverUrl);
- background_view_ = new ScreenLockerBackgroundView(lock_widget_,
- screen_lock_view_);
+ background_view_ = new ScreenLockerBackgroundView(lock_widget_);
background_view_->Init(GURL(url_string));
if (background_view_->ScreenSaverEnabled())
StartScreenSaver();
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 6d437f2..cb2629a 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -319,6 +319,7 @@ void WizardController::OwnBackground(
DCHECK(!background_widget_);
background_widget_ = background_widget;
background_view_ = background_view;
+ background_view_->OnOwnerChanged();
}
chromeos::NetworkScreen* WizardController::GetNetworkScreen() {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index b0f0b60..ef2d698 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -616,8 +616,6 @@
'browser/chromeos/login/screen_lock_view.cc',
'browser/chromeos/login/screen_lock_view.h',
'browser/chromeos/login/screen_observer.h',
- 'browser/chromeos/login/shutdown_button.cc',
- 'browser/chromeos/login/shutdown_button.h',
'browser/chromeos/login/signed_settings.cc',
'browser/chromeos/login/signed_settings.h',
'browser/chromeos/login/signed_settings_helper.cc',
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index 8e2bdea..bcff70d 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -15,8 +15,8 @@
namespace views {
-// Default padding between the icon and text.
-static const int kDefaultIconTextPadding = 5;
+// Padding between the icon and text.
+static const int kIconTextPadding = 5;
// Preferred padding between text and edge
static const int kPreferredPaddingHorizontal = 6;
@@ -195,8 +195,7 @@ TextButton::TextButton(ButtonListener* listener, const std::wstring& text)
max_width_(0),
normal_has_border_(false),
show_multiple_icon_states_(true),
- prefix_type_(PREFIX_NONE),
- icon_text_padding_(kDefaultIconTextPadding) {
+ prefix_type_(PREFIX_NONE) {
SetText(text);
set_border(new TextButtonBorder);
SetAnimationDuration(kHoverAnimationDurationMs);
@@ -298,7 +297,7 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
if (icon.width() > 0) {
content_width += icon.width();
if (!text_.empty())
- content_width += icon_text_padding_;
+ content_width += kIconTextPadding;
}
// Place the icon along the left edge.
int icon_x;
@@ -312,7 +311,7 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
}
int text_x = icon_x;
if (icon.width() > 0)
- text_x += icon.width() + icon_text_padding_;
+ text_x += icon.width() + kIconTextPadding;
const int text_width = std::min(text_size_.width(),
width() - insets.right() - text_x);
int text_y = (available_height - text_size_.height()) / 2 + insets.top();
@@ -320,7 +319,7 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
// If the icon should go on the other side, swap the elements.
if (icon_placement_ == ICON_ON_RIGHT) {
int new_text_x = icon_x;
- icon_x = new_text_x + text_width + icon_text_padding_;
+ icon_x = new_text_x + text_width + kIconTextPadding;
text_x = new_text_x;
}
@@ -410,7 +409,7 @@ gfx::Size TextButton::GetPreferredSize() {
insets.height());
if (icon_.width() > 0 && !text_.empty())
- prefsize.Enlarge(icon_text_padding_, 0);
+ prefsize.Enlarge(kIconTextPadding, 0);
if (max_width_ > 0)
prefsize.set_width(std::min(max_width_, prefsize.width()));
diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h
index b96901e..d37f1aa 100644
--- a/views/controls/button/text_button.h
+++ b/views/controls/button/text_button.h
@@ -109,10 +109,6 @@ class TextButton : public CustomButton {
void set_prefix_type(PrefixType type) { prefix_type_ = type; }
- void set_icon_text_padding(int icon_text_padding) {
- icon_text_padding_ = icon_text_padding;
- }
-
// Sets the icon.
void SetIcon(const SkBitmap& icon);
void SetHoverIcon(const SkBitmap& icon);
@@ -230,9 +226,6 @@ class TextButton : public CustomButton {
PrefixType prefix_type_;
- // Padding between icon and text.
- int icon_text_padding_;
-
DISALLOW_COPY_AND_ASSIGN(TextButton);
};