diff options
author | dpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 08:53:15 +0000 |
---|---|---|
committer | dpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 08:53:15 +0000 |
commit | 41ea330bfb629ca0363fbea531bfe552072ea3bb (patch) | |
tree | f0515fa20ab90176cc22d76ad9f74881ea239c5c | |
parent | df11989a817911eb012c89894ebd91a13395604c (diff) | |
download | chromium_src-41ea330bfb629ca0363fbea531bfe552072ea3bb.zip chromium_src-41ea330bfb629ca0363fbea531bfe552072ea3bb.tar.gz chromium_src-41ea330bfb629ca0363fbea531bfe552072ea3bb.tar.bz2 |
Land 3189012: "Go incognito" button in bottom right corner
Original CL: http://codereview.chromium.org/3189012/show
Implemented "Go incognito" button that appears in bottom right corner
if oobe process is done. Otherwise usual "browse without signin" link
appears in the new login entry.
BUG=chromium-os:5630
TEST=When login screen is loaded there is button in bottom right corner (if no OOBE status bar).
Review URL: http://codereview.chromium.org/3231002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57652 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/background_view.cc | 117 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/background_view.h | 32 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/existing_user_controller.cc | 11 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/existing_user_controller.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/login_screen.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/new_user_view.cc | 30 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/new_user_view.h | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/rounded_rect_painter.cc | 51 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/rounded_rect_painter.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_controller.cc | 15 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_controller.h | 6 |
11 files changed, 263 insertions, 21 deletions
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index a351023..7b64b24 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/login/background_view.h" +#include <string> +#include <vector> #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/x11_util.h" @@ -11,6 +13,7 @@ #include "base/utf_string_conversions.h" #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/status/clock_menu_button.h" #include "chrome/browser/chromeos/status/feedback_menu_button.h" #include "chrome/browser/chromeos/status/language_menu_button.h" @@ -20,6 +23,8 @@ #include "cros/chromeos_wm_ipc_enums.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "grit/theme_resources.h" +#include "views/controls/button/text_button.h" #include "views/controls/label.h" #include "views/screen.h" #include "views/widget/widget_gtk.h" @@ -31,6 +36,34 @@ using views::WidgetGtk; +namespace { + +// The same as TextButton but switches cursor to hand cursor when mouse +// is over the button. +class TextButtonWithHandCursorOver : public views::TextButton { + public: + TextButtonWithHandCursorOver(views::ButtonListener* listener, + const std::wstring& text) + : views::TextButton(listener, text) { + } + + virtual ~TextButtonWithHandCursorOver() {} + + virtual gfx::NativeCursor GetCursorForPoint( + views::Event::EventType event_type, + const gfx::Point& p) { + if (!IsEnabled()) { + return NULL; + } + return gdk_cursor_new(GDK_HAND2); + } + + private: + DISALLOW_COPY_AND_ASSIGN(TextButtonWithHandCursorOver); +}; + +} // namespace + namespace chromeos { BackgroundView::BackgroundView() @@ -38,6 +71,7 @@ BackgroundView::BackgroundView() os_version_label_(NULL), boot_times_label_(NULL), progress_bar_(NULL), + go_incognito_button_(NULL), did_paint_(false) { views::Painter* painter = CreateBackgroundPainter(); set_background(views::Background::CreateBackgroundPainter(true, painter)); @@ -96,6 +130,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, @@ -123,6 +159,14 @@ void BackgroundView::Layout() { kProgressBarWidth, kProgressBarHeight); } + 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()); + } } void BackgroundView::ChildPreferredSizeChanged(View* child) { @@ -158,7 +202,18 @@ 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(); + } + } +} + void BackgroundView::OnLocaleChanged() { + UpdateLocalizedStrings(); Layout(); SchedulePaint(); } @@ -213,6 +268,49 @@ 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() { + go_incognito_button_->SetText( + UTF8ToWide(l10n_util::GetStringUTF8(IDS_GO_INCOGNITO_BUTTON))); +} + void BackgroundView::SetOobeProgressBarVisible(bool visible) { if (!progress_bar_ && visible) InitProgressBar(); @@ -221,6 +319,25 @@ void BackgroundView::SetOobeProgressBarVisible(bool visible) { progress_bar_->SetVisible(visible); } +bool BackgroundView::IsOobeProgressBarVisible() { + return progress_bar_ && progress_bar_->IsVisible(); +} + +// 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::SetOobeProgress(LoginStep step) { DCHECK(step <= PICTURE); if (progress_bar_) diff --git a/chrome/browser/chromeos/login/background_view.h b/chrome/browser/chromeos/login/background_view.h index 7a15f53..fee00d3 100644 --- a/chrome/browser/chromeos/login/background_view.h +++ b/chrome/browser/chromeos/login/background_view.h @@ -10,11 +10,13 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/version_loader.h" #include "chrome/browser/chromeos/status/status_area_host.h" +#include "views/controls/button/button.h" #include "views/view.h" namespace views { class Widget; class Label; +class TextButton; } class Profile; @@ -26,8 +28,19 @@ class StatusAreaView; // View used to render the background during login. BackgroundView contains // StatusAreaView. -class BackgroundView : public views::View, public StatusAreaHost { +class BackgroundView : public views::View, + 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) @@ -54,9 +67,15 @@ class BackgroundView : public views::View, public StatusAreaHost { // Toggles OOBE progress bar visibility, the bar is hidden by default. void SetOobeProgressBarVisible(bool visible); + // Gets progress bar visibility. + bool IsOobeProgressBarVisible(); + // Sets current step on OOBE progress bar. void SetOobeProgress(LoginStep step); + // Toggles GoIncognito button visibility. + void SetGoIncognitoButtonVisible(bool visible, Delegate *delegate); + protected: // Overridden from views::View: virtual void Paint(gfx::Canvas* canvas); @@ -74,6 +93,9 @@ class BackgroundView : public views::View, public StatusAreaHost { 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(); @@ -81,6 +103,11 @@ class BackgroundView : public views::View, public StatusAreaHost { 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. @@ -96,6 +123,7 @@ class BackgroundView : public views::View, public StatusAreaHost { views::Label* os_version_label_; views::Label* boot_times_label_; OobeProgressBar* progress_bar_; + views::TextButton* go_incognito_button_; // Handles asynchronously loading the version. VersionLoader version_loader_; @@ -112,6 +140,8 @@ class BackgroundView : public views::View, public StatusAreaHost { // TODO(sky): nuke this when the wm knows when chrome has painted. bool did_paint_; + Delegate *delegate_; + DISALLOW_COPY_AND_ASSIGN(BackgroundView); }; diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index e7e3d2e..8c77ee3 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -113,12 +113,16 @@ void ExistingUserController::Init() { if (!WizardController::IsDeviceRegistered()) { background_view_->SetOobeProgressBarVisible(true); background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); + } else { + background_view_->SetGoIncognitoButtonVisible(true, this); } + background_window_->Show(); } for (size_t i = 0; i < controllers_.size(); ++i) { (controllers_[i])->Init(static_cast<int>(i), - static_cast<int>(controllers_.size())); + static_cast<int>(controllers_.size()), + background_view_->IsOobeProgressBarVisible()); } EnableTooltipsIfNeeded(controllers_); @@ -292,6 +296,10 @@ void ExistingUserController::SelectUser(int index) { } } +void ExistingUserController::OnGoIncognitoButton() { + LoginOffTheRecord(); +} + void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { LOG(INFO) << "OnLoginFailure"; ClearCaptchaState(); @@ -306,7 +314,6 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { } else if (!network->Connected()) { ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); } else { - if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { if (!failure.error().captcha().image_url.is_empty()) { diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h index 1306c15..6281eb3 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.h +++ b/chrome/browser/chromeos/login/existing_user_controller.h @@ -12,6 +12,7 @@ #include "base/ref_counted.h" #include "base/task.h" #include "base/timer.h" +#include "chrome/browser/chromeos/login/background_view.h" #include "chrome/browser/chromeos/login/captcha_view.h" #include "chrome/browser/chromeos/login/login_status_consumer.h" #include "chrome/browser/chromeos/login/message_bubble.h" @@ -25,7 +26,6 @@ namespace chromeos { class Authenticator; -class BackgroundView; class MessageBubble; // ExistingUserController is used to handle login when someone has already @@ -40,6 +40,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 LoginStatusConsumer, public MessageBubbleDelegate, public CaptchaView::Delegate, @@ -85,6 +86,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(); + // LoginStatusConsumer: virtual void OnLoginFailure(const LoginFailure& error); virtual void OnLoginSuccess(const std::string& username, diff --git a/chrome/browser/chromeos/login/login_screen.cc b/chrome/browser/chromeos/login/login_screen.cc index 23493ef..273648b 100644 --- a/chrome/browser/chromeos/login/login_screen.cc +++ b/chrome/browser/chromeos/login/login_screen.cc @@ -43,7 +43,7 @@ LoginScreen::~LoginScreen() { } NewUserView* LoginScreen::AllocateView() { - return new NewUserView(this, true); + return new NewUserView(this, true, true); } void LoginScreen::OnLogin(const std::string& username, diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc index 6e1e341..f8c2963 100644 --- a/chrome/browser/chromeos/login/new_user_view.cc +++ b/chrome/browser/chromeos/login/new_user_view.cc @@ -72,7 +72,9 @@ class UsernameField : public views::Textfield { namespace chromeos { -NewUserView::NewUserView(Delegate* delegate, bool need_border) +NewUserView::NewUserView(Delegate* delegate, + bool need_border, + bool need_browse_without_signin) : username_field_(NULL), password_field_(NULL), title_label_(NULL), @@ -88,7 +90,8 @@ NewUserView::NewUserView(Delegate* delegate, bool need_border) ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), focus_delayed_(false), login_in_process_(false), - need_border_(need_border) { + need_border_(need_border), + need_browse_without_signin_(need_browse_without_signin) { } NewUserView::~NewUserView() { @@ -127,7 +130,9 @@ void NewUserView::Init() { InitLink(&create_account_link_); InitLink(&cant_access_account_link_); - InitLink(&browse_without_signin_link_); + if (need_browse_without_signin_) { + InitLink(&browse_without_signin_link_); + } language_switch_menu_.InitLanguageMenu(); languages_menubutton_ = new views::MenuButton( @@ -188,8 +193,10 @@ void NewUserView::UpdateLocalizedStrings() { l10n_util::GetString(IDS_CREATE_ACCOUNT_BUTTON)); cant_access_account_link_->SetText( l10n_util::GetString(IDS_CANT_ACCESS_ACCOUNT_BUTTON)); - browse_without_signin_link_->SetText( - l10n_util::GetString(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON)); + if (need_browse_without_signin_) { + browse_without_signin_link_->SetText( + l10n_util::GetString(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON)); + } delegate_->ClearErrors(); languages_menubutton_->SetText(language_switch_menu_.GetCurrentLocaleName()); } @@ -274,13 +281,16 @@ void NewUserView::Layout() { int max_width = this->width() - x - insets.right(); title_label_->SizeToFit(max_width); + int browse_without_signin_link_height = need_browse_without_signin_ ? + browse_without_signin_link_->GetPreferredSize().height() : 0; + height = title_label_->GetPreferredSize().height() + username_field_->GetPreferredSize().height() + password_field_->GetPreferredSize().height() + sign_in_button_->GetPreferredSize().height() + create_account_link_->GetPreferredSize().height() + cant_access_account_link_->GetPreferredSize().height() + - browse_without_signin_link_->GetPreferredSize().height() + + browse_without_signin_link_height + 4 * kRowPad; y = (this->height() - height) / 2; @@ -297,8 +307,10 @@ void NewUserView::Layout() { false); y += setViewBounds(create_account_link_, x, y, max_width, false); y += setViewBounds(cant_access_account_link_, x, y, max_width, false); - y += setViewBounds(browse_without_signin_link_, x, y, max_width, false); + if (need_browse_without_signin_) { + y += setViewBounds(browse_without_signin_link_, x, y, max_width, false); + } SchedulePaint(); } @@ -411,7 +423,9 @@ void NewUserView::EnableInputControls(bool enabled) { sign_in_button_->SetEnabled(enabled); create_account_link_->SetEnabled(enabled); cant_access_account_link_->SetEnabled(enabled); - browse_without_signin_link_->SetEnabled(enabled); + if (need_browse_without_signin_) { + browse_without_signin_link_->SetEnabled(enabled); + } } void NewUserView::InitLink(views::Link** link) { diff --git a/chrome/browser/chromeos/login/new_user_view.h b/chrome/browser/chromeos/login/new_user_view.h index d60109e..b744e9e 100644 --- a/chrome/browser/chromeos/login/new_user_view.h +++ b/chrome/browser/chromeos/login/new_user_view.h @@ -58,7 +58,10 @@ class NewUserView : public views::View, }; // If |need_border| is true, RoundedRect border and background are required. - NewUserView(Delegate* delegate, bool need_border); + NewUserView(Delegate* delegate, + bool need_border, + bool need_browse_without_signin); + virtual ~NewUserView(); // Initialize view layout. @@ -163,6 +166,9 @@ class NewUserView : public views::View, // If true, this view needs RoundedRect border and background. bool need_border_; + // Whether browse without signin is needed. + bool need_browse_without_signin_; + FRIEND_TEST_ALL_PREFIXES(LoginScreenTest, IncognitoLogin); friend class LoginScreenTest; diff --git a/chrome/browser/chromeos/login/rounded_rect_painter.cc b/chrome/browser/chromeos/login/rounded_rect_painter.cc index 64e73af..b134cce 100644 --- a/chrome/browser/chromeos/login/rounded_rect_painter.cc +++ b/chrome/browser/chromeos/login/rounded_rect_painter.cc @@ -182,7 +182,48 @@ void RoundedRectBorder::GetInsets(gfx::Insets* insets) const { insets->Set(inset - shadow / 3, inset, inset + shadow / 3, inset); } -} // namespace +// Simple solid round background. +class RoundedBackground : public views::Background { + public: + explicit RoundedBackground(int corner_radius, + int stroke_width, + const SkColor& background_color, + const SkColor& stroke_color) + : corner_radius_(corner_radius), + stroke_width_(stroke_width), + stroke_color_(stroke_color) { + SetNativeControlColor(background_color); + } + + virtual void Paint(gfx::Canvas* canvas, views::View* view) const { + SkRect rect; + rect.iset(0, 0, view->width(), view->height()); + SkPath path; + path.addRoundRect(rect, + SkIntToScalar(corner_radius_), + SkIntToScalar(corner_radius_)); + // Draw interior. + SkPaint paint; + paint.setStyle(SkPaint::kFill_Style); + paint.setFlags(SkPaint::kAntiAlias_Flag); + paint.setColor(get_color()); + canvas->AsCanvasSkia()->drawPath(path, paint); + // Redraw boundary region with correspoinding color. + paint.setStyle(SkPaint::kStroke_Style); + paint.setStrokeWidth(SkIntToScalar(stroke_width_)); + paint.setColor(stroke_color_); + canvas->AsCanvasSkia()->drawPath(path, paint); + } + + private: + int corner_radius_; + int stroke_width_; + SkColor stroke_color_; + + DISALLOW_COPY_AND_ASSIGN(RoundedBackground); +}; + +} // namespace // static const BorderDefinition BorderDefinition::kScreenBorder = { @@ -203,4 +244,12 @@ views::Border* CreateWizardBorder(const BorderDefinition* const border) { return new RoundedRectBorder(border); } +views::Background* CreateRoundedBackground(int corner_radius, + int stroke_width, + SkColor background_color, + SkColor stroke_color) { + return new RoundedBackground( + corner_radius, stroke_width, background_color, stroke_color); +} + } // namespace chromeos diff --git a/chrome/browser/chromeos/login/rounded_rect_painter.h b/chrome/browser/chromeos/login/rounded_rect_painter.h index de2dd41..ce7661f 100644 --- a/chrome/browser/chromeos/login/rounded_rect_painter.h +++ b/chrome/browser/chromeos/login/rounded_rect_painter.h @@ -9,6 +9,7 @@ #include "third_party/skia/include/core/SkColor.h" namespace views { +class Background; class Border; class Painter; } // namespace views @@ -33,6 +34,11 @@ views::Painter* CreateWizardPainter(const BorderDefinition* const border); // that actually draws both border and background. views::Border* CreateWizardBorder(const BorderDefinition* const border); +// Creates simple round background. +views::Background* CreateRoundedBackground(int corner_radius, + int stroke_width, + SkColor background_color, + SkColor stroke_color); } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_RECT_PAINTER_H_ diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc index 75ba03f..d59519b 100644 --- a/chrome/browser/chromeos/login/user_controller.cc +++ b/chrome/browser/chromeos/login/user_controller.cc @@ -150,9 +150,12 @@ UserController::~UserController() { unselected_label_window_->Close(); } -void UserController::Init(int index, int total_user_count) { +void UserController::Init(int index, + int total_user_count, + bool need_browse_without_signin) { int controls_height = 0; - controls_window_ = CreateControlsWindow(index, &controls_height); + controls_window_ = + CreateControlsWindow(index, &controls_height, need_browse_without_signin); image_window_ = CreateImageWindow(index); CreateBorderWindow(index, total_user_count, controls_height); label_window_ = CreateLabelWindow(index, WM_IPC_WINDOW_LOGIN_LABEL); @@ -280,10 +283,14 @@ void UserController::ConfigureLoginWindow(WidgetGtk* window, window->Show(); } -WidgetGtk* UserController::CreateControlsWindow(int index, int* height) { +WidgetGtk* UserController::CreateControlsWindow( + int index, + int* height, + bool need_browse_without_signin) { views::View* control_view; if (is_guest_) { - new_user_view_ = new NewUserView(this, false); + new_user_view_ = + new NewUserView(this, false, need_browse_without_signin); new_user_view_->Init(); control_view = new_user_view_; } else { diff --git a/chrome/browser/chromeos/login/user_controller.h b/chrome/browser/chromeos/login/user_controller.h index 9fb39fb..370d79e 100644 --- a/chrome/browser/chromeos/login/user_controller.h +++ b/chrome/browser/chromeos/login/user_controller.h @@ -68,7 +68,7 @@ class UserController : public views::ButtonListener, // Initializes the UserController, creating the set of windows/controls. // |index| is the index of this user, and |total_user_count| the total // number of users. - void Init(int index, int total_user_count); + void Init(int index, int total_user_count, bool need_browse_without_signin); // Update border window parameters to notify window manager about new numbers. // |index| of this user and |total_user_count| of users. @@ -153,7 +153,9 @@ class UserController : public views::ButtonListener, const gfx::Rect& bounds, chromeos::WmIpcWindowType type, views::View* contents_view); - views::WidgetGtk* CreateControlsWindow(int index, int* height); + views::WidgetGtk* CreateControlsWindow(int index, + int* height, + bool need_browse_without_signin); views::WidgetGtk* CreateImageWindow(int index); views::WidgetGtk* CreateLabelWindow(int index, WmIpcWindowType type); void CreateBorderWindow(int index, int total_user_count, int controls_height); |