diff options
author | noms@chromium.org <noms@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-25 18:43:50 +0000 |
---|---|---|
committer | noms@chromium.org <noms@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-25 18:43:50 +0000 |
commit | 700ce309b5dcea6ccb6cba0d67d015800632ad9a (patch) | |
tree | c33ce79fb9685cf407e9f23b5a14f0d42a6a040d | |
parent | 9503886f840df82d22f2f01311c87204bf646695 (diff) | |
download | chromium_src-700ce309b5dcea6ccb6cba0d67d015800632ad9a.zip chromium_src-700ce309b5dcea6ccb6cba0d67d015800632ad9a.tar.gz chromium_src-700ce309b5dcea6ccb6cba0d67d015800632ad9a.tar.bz2 |
New avatar menu UI fixes:
- added a "view all profiles" button that opens the user manager
- added a custom button that has a background when hovered
(see https://docs.google.com/file/d/0B1B1Up4p2NRMbktkLXQ0SFRxYXc/edit?usp=sharing)
- cleaned up all the incorrect usages of "vertical" when I actually meant "horizontal" (>_<)
(no-trying the CL because the linux_aura bot is broken)
BUG=287883
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/23526074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225218 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 9 | ||||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 11 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_manager.h | 14 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_window.cc | 12 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_window.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/profile_chooser_view.cc | 182 | ||||
-rw-r--r-- | chrome/browser/ui/views/profile_chooser_view.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/signin/user_manager_screen_handler.cc | 8 | ||||
-rw-r--r-- | ui/views/controls/menu/menu_win.cc | 7 | ||||
-rw-r--r-- | ui/views/controls/menu/native_menu_win.cc | 7 | ||||
-rw-r--r-- | ui/views/layout/layout_constants.h | 4 |
11 files changed, 188 insertions, 74 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 8d02132..3943076 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -11214,15 +11214,18 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr <message name="IDS_PROFILES_EDIT_PROFILE_LINK" desc="Link in the avatar menu bubble to edit a profile."> edit </message> - <message name="IDS_PROFILES_PROFILE_USERS_BUTTON" desc="Button in the avatar menu bubble view for switching users."> + <message name="IDS_PROFILES_ADD_PERSON_BUTTON" desc="Button in the avatar menu bubble view for creating a new user."> Add person </message> - <message name="IDS_PROFILES_PROFILE_GUEST_BUTTON" desc="Button in the avatar menu bubble view for guest browsing."> + <message name="IDS_PROFILES_GUEST_BUTTON" desc="Button in the avatar menu bubble view for guest browsing."> Browse as guest </message> - <message name="IDS_PROFILES_PROFILE_EXIT_GUEST_BUTTON" desc="Button in the avatar menu bubble view for guest browsing."> + <message name="IDS_PROFILES_EXIT_GUEST_BUTTON" desc="Button in the avatar menu bubble view to end guest browsing."> End guest session </message> + <message name="IDS_PROFILES_ALL_PEOPLE_BUTTON" desc="Button in the avatar menu bubble view for launching the user manager."> + View all people + </message> <message name="IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON" desc="Button in the avatar menu bubble view used to add an account to a profile."> Add account for <ph name="PROFILE_NAME">$1<ex>John</ex></ph> </message> diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 2fd43df..475ab3a 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -342,15 +342,20 @@ <structure type="chrome_scaled_image" name="IDR_HOME_P" file="common/browser_home_pressed.png" /> </if> <if expr="not is_android and not is_ios"> - <structure type="chrome_scaled_image" name="IDR_ICON_ADD_USER24" file="icon_add_user24.png" /> - <structure type="chrome_scaled_image" name="IDR_ICON_ADD_USER_WHITE" file="icon_add_user_white.png" /> - <structure type="chrome_scaled_image" name="IDR_ICON_GUEST_WHITE" file="icon_guest_white.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_PROFILES_ADD_USER" file="common/icon_add_user.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_PROFILES_ADD_USER_WHITE" file="common/icon_add_user_white.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_PROFILES_BROWSE_GUEST" file="common/icon_browse_as_guest.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_PROFILES_BROWSE_GUEST_WHITE" file="common/icon_browse_as_guest_white.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_PROFILES_LOCKED" file="common/icon_locked.png" /> </if> <if expr="not is_android and not is_ios and not pp_ifdef('chromeos')"> <!-- TODO(noms): Remove this once local profile avatars are migrated --> <structure type="chrome_scaled_image" name="IDR_USER_MANAGER_DEFAULT_AVATAR" file="avatar_user_color.png" /> </if> <if expr="pp_ifdef('chromeos')"> + <structure type="chrome_scaled_image" name="IDR_ICON_ADD_USER24" file="icon_add_user24.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_ADD_USER_WHITE" file="icon_add_user_white.png" /> + <structure type="chrome_scaled_image" name="IDR_ICON_GUEST_WHITE" file="icon_guest_white.png" /> <structure type="chrome_scaled_image" name="IDR_ICON_POWER24" file="icon_power24.png" /> <structure type="chrome_scaled_image" name="IDR_ICON_POWER_WHITE" file="icon_power_white.png" /> </if> diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h index bca991b..f84ac95 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h @@ -166,6 +166,13 @@ class ProfileManager : public base::NonThreadSafe, // Returns the full path to be used for guest profiles. static base::FilePath GetGuestProfilePath(); + // Get the path of the next profile directory and increment the internal + // count. + // Lack of side effects: + // This function doesn't actually create the directory or touch the file + // system. + base::FilePath GenerateNextProfileDirectoryPath(); + // Returns a ProfileInfoCache object which can be used to get information // about profiles without having to load them from disk. ProfileInfoCache& GetProfileInfoCache(); @@ -280,13 +287,6 @@ class ProfileManager : public base::NonThreadSafe, // For ChromeOS, determines if profile should be otr. bool ShouldGoOffTheRecord(Profile* profile); - // Get the path of the next profile directory and increment the internal - // count. - // Lack of side effects: - // This function doesn't actually create the directory or touch the file - // system. - base::FilePath GenerateNextProfileDirectoryPath(); - void RunCallbacks(const std::vector<CreateCallback>& callbacks, Profile* profile, Profile::CreateStatus status); diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc index 1cdbdcf..41ddea9 100644 --- a/chrome/browser/profiles/profile_window.cc +++ b/chrome/browser/profiles/profile_window.cc @@ -87,6 +87,18 @@ void SwitchToProfile( std::string()); } +void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type) { + ProfileManager* profile_manager = g_browser_process->profile_manager(); + base::FilePath new_path = profile_manager->GenerateNextProfileDirectoryPath(); + profile_manager->CreateProfileAsync(new_path, + base::Bind(&OpenBrowserWindowForProfile, + true, + desktop_type), + string16(), + string16(), + std::string()); +} + void CloseGuestProfileWindows() { ProfileManager* profile_manager = g_browser_process->profile_manager(); Profile* profile = profile_manager->GetProfileByPath( diff --git a/chrome/browser/profiles/profile_window.h b/chrome/browser/profiles/profile_window.h index 9efc146..77fc4e2 100644 --- a/chrome/browser/profiles/profile_window.h +++ b/chrome/browser/profiles/profile_window.h @@ -34,6 +34,10 @@ void SwitchToProfile( chrome::HostDesktopType desktop_type, bool always_create); +// Creates a new profile from the next available profile directory, and +// opens a new browser window for the profile once it is ready. +void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type); + // Closes all browser windows that belong to the guest profile. void CloseGuestProfileWindows(); diff --git a/chrome/browser/ui/views/profile_chooser_view.cc b/chrome/browser/ui/views/profile_chooser_view.cc index 6998c5e..5e34a6f 100644 --- a/chrome/browser/ui/views/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profile_chooser_view.cc @@ -9,11 +9,13 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/signin/signin_promo.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/singleton_tabs.h" #include "chrome/browser/ui/views/user_manager_view.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" @@ -30,13 +32,18 @@ #include "ui/views/layout/layout_constants.h" #include "ui/views/widget/widget.h" -// Helpers -------------------------------------------------------------------- +#if defined(USE_AURA) +#include "ui/native_theme/native_theme_aura.h" +#endif namespace { +// Helpers -------------------------------------------------------------------- + const int kLargeImageSide = 64; const int kSmallImageSide = 32; const int kMinMenuWidth = 250; +const int kButtonHeight = 29; // Current profile avatar image. views::View* CreateProfileImageView(const gfx::Image& icon) { @@ -71,13 +78,13 @@ views::GridLayout* CreateDoubleColumnLayout(views::View* view) { views::ColumnSet* columns = layout->AddColumnSet(0); columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, views::GridLayout::USE_PREF, 0, 0); - columns->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing); + columns->AddPaddingColumn(0, views::kUnrelatedControlLargeHorizontalSpacing); columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::TRAILING, 1, views::GridLayout::USE_PREF, 0, 0); return layout; } -views::Link* CreateLink(const string16 link_text, +views::Link* CreateLink(const string16& link_text, views::LinkListener* listener) { views::Link* link_button = new views::Link(link_text); link_button->SetHorizontalAlignment(gfx::ALIGN_LEFT); @@ -86,6 +93,82 @@ views::Link* CreateLink(const string16 link_text, return link_button; } + +// HorizontalPaddingButtonBorder ---------------------------------------------- + +// A button border that adds padding before the icon and after the text. This +// is needed so that the button looks like it is spanning the entire parent +// view (especially when hovered over), but has the icon indented and aligned +// with the other items in the parent view. +class HorizontalPaddingButtonBorder : public views::TextButtonBorder { + public: + HorizontalPaddingButtonBorder() : views::TextButtonBorder() { + SetInsets(gfx::Insets(0, views::kButtonHEdgeMarginNew, + 0, views::kButtonHEdgeMarginNew)); + }; + + virtual ~HorizontalPaddingButtonBorder() { + }; + + private: + // This function is pure virtual in the parent, so we must provide an + // implementation. + virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE { + }; + + DISALLOW_COPY_AND_ASSIGN(HorizontalPaddingButtonBorder); +}; + + +// BackgroundColorHoverButton ------------------------------------------------- + +// A custom button that allows for setting a background color when hovered over. +class BackgroundColorHoverButton : public views::TextButton { + public: + BackgroundColorHoverButton(views::ButtonListener* listener, + const string16& text, + const gfx::ImageSkia& normal_icon, + const gfx::ImageSkia& hover_icon) + : views::TextButton(listener, text) { + set_border(new HorizontalPaddingButtonBorder); + set_min_height(kButtonHeight); + set_icon_text_spacing(views::kItemLabelSpacing); + SetIcon(normal_icon); + SetHoverIcon(hover_icon); + SetPushedIcon(hover_icon); + SetHoverColor(GetNativeTheme()->GetSystemColor( + ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor)); + OnHighlightStateChanged(); + }; + + virtual ~BackgroundColorHoverButton(){ + }; + + private: + virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE { + views::TextButton::OnMouseEntered(event); + OnHighlightStateChanged(); + }; + + virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE { + views::TextButton::OnMouseExited(event); + OnHighlightStateChanged(); + }; + + void OnHighlightStateChanged() { + bool is_highlighted = (state() == views::TextButton::STATE_PRESSED) || + (state() == views::TextButton::STATE_HOVERED) || HasFocus(); + ui::NativeTheme::ColorId color_id = is_highlighted ? + ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor : + ui::NativeTheme::kColorId_MenuBackgroundColor; + set_background(views::Background::CreateSolidBackground( + GetNativeTheme()->GetSystemColor(color_id))); + SchedulePaint(); + }; + + DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); +}; + } // namespace @@ -154,6 +237,7 @@ void ProfileChooserView::ResetLinksAndButtons() { guest_button_ = NULL; end_guest_button_ = NULL; users_button_ = NULL; + add_user_button_ = NULL; open_other_profile_indexes_map_.clear(); } @@ -252,6 +336,8 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, profiles::CloseGuestProfileWindows(); } else if (sender == users_button_) { UserManagerView::Show(browser_); + } else if (sender == add_user_button_) { + profiles::CreateAndSwitchToNewProfile(browser_->host_desktop_type()); } else { // One of the "other profiles" buttons was pressed. ButtonIndexes::const_iterator match = @@ -285,10 +371,10 @@ views::View* ProfileChooserView::CreateCurrentProfileView( bool is_guest) { views::View* view = new views::View(); views::GridLayout* layout = CreateDoubleColumnLayout(view); - layout->SetInsets(views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew, + layout->SetInsets(views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew); + views::kButtonVEdgeMarginNew, + views::kButtonHEdgeMarginNew); views::View* photo_image = CreateProfileImageView(avatar_item.icon); view->SetBoundsRect(photo_image->bounds()); @@ -317,10 +403,10 @@ views::View* ProfileChooserView::CreateCurrentProfileView( l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), this); layout->StartRow(1, 0); layout->SkipColumns(1); - layout->AddView(manage_accounts_link_); + layout->AddView(signout_current_profile_link_); layout->StartRow(1, 0); layout->SkipColumns(1); - layout->AddView(signout_current_profile_link_); + layout->AddView(manage_accounts_link_); } else { signin_current_profile_link_ = CreateLink( l10n_util::GetStringFUTF16( @@ -342,10 +428,10 @@ views::View* ProfileChooserView::CreateCurrentProfileEditableView( DCHECK(avatar_item.signed_in); views::View* view = new views::View(); views::GridLayout* layout = CreateDoubleColumnLayout(view); - layout->SetInsets(views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew, + layout->SetInsets(views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew); + views::kButtonVEdgeMarginNew, + views::kButtonHEdgeMarginNew); views::View* photo_image = CreateProfileImageView(avatar_item.icon); view->SetBoundsRect(photo_image->bounds()); @@ -391,15 +477,11 @@ views::View* ProfileChooserView::CreateOtherProfilesView( const Indexes& avatars_to_show) { views::View* view = new views::View(); views::GridLayout* layout = CreateSingleColumnLayout(view); - layout->SetInsets(0 - views::kRelatedControlHorizontalSpacing, - views::kButtonVEdgeMarginNew, - views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew); - - for (Indexes::const_iterator iter = avatars_to_show.begin(); - iter != avatars_to_show.end(); - ++iter) { - const size_t index = *iter; + layout->SetInsets(0, views::kButtonHEdgeMarginNew, + views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew); + int num_avatars_to_show = avatars_to_show.size(); + for (int i = 0; i < num_avatars_to_show; ++i) { + const size_t index = avatars_to_show[i]; const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); gfx::Image image = profiles::GetSizedAvatarIconWithBorder( @@ -410,13 +492,17 @@ views::View* ProfileChooserView::CreateOtherProfilesView( views::TextButton* button = new views::TextButton(this, item.name); open_other_profile_indexes_map_[button] = index; button->SetIcon(*image.ToImageSkia()); + button->set_icon_text_spacing(views::kItemLabelSpacing); button->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( - ui::ResourceBundle::BaseFont)); + ui::ResourceBundle::MediumFont)); button->set_border(NULL); - layout->AddPaddingRow(0, views::kRelatedControlHorizontalSpacing); layout->StartRow(1, 0); layout->AddView(button); + + // The last avatar in the list does not need any bottom padding. + if (i < num_avatars_to_show - 1) + layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); } return view; @@ -425,35 +511,43 @@ views::View* ProfileChooserView::CreateOtherProfilesView( views::View* ProfileChooserView::CreateOptionsView(bool is_guest_view) { views::View* view = new views::View(); views::GridLayout* layout = CreateSingleColumnLayout(view); - layout->SetInsets(views::kRelatedControlHorizontalSpacing, - views::kButtonVEdgeMarginNew, - views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew); + // The horizontal padding will be set by each button individually, so that + // in the hovered state the button spans the entire parent view. + layout->SetInsets(views::kRelatedControlVerticalSpacing, 0, + views::kRelatedControlVerticalSpacing, 0); ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); layout->StartRow(1, 0); if (is_guest_view) { - end_guest_button_ = new views::TextButton(this, - l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_EXIT_GUEST_BUTTON)); - end_guest_button_->SetIcon( - *rb->GetImageSkiaNamed(IDR_ICON_GUEST_WHITE)); - end_guest_button_->set_border(NULL); + end_guest_button_ = new BackgroundColorHoverButton( + this, + l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST_BUTTON), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_BROWSE_GUEST), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_BROWSE_GUEST_WHITE)); layout->AddView(end_guest_button_); } else { - guest_button_ = new views::TextButton(this, - l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_GUEST_BUTTON)); - guest_button_->SetIcon(*rb->GetImageSkiaNamed(IDR_ICON_GUEST_WHITE)); - guest_button_->set_border(NULL); + guest_button_ = new BackgroundColorHoverButton( + this, + l10n_util::GetStringUTF16(IDS_PROFILES_GUEST_BUTTON), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_BROWSE_GUEST), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_BROWSE_GUEST_WHITE)); layout->AddView(guest_button_); } - users_button_ = new views::TextButton(this, - l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_USERS_BUTTON)); - users_button_->SetIcon(*rb->GetImageSkiaNamed(IDR_ICON_ADD_USER_WHITE)); - users_button_->set_border(NULL); + add_user_button_ = new BackgroundColorHoverButton( + this, + l10n_util::GetStringUTF16(IDS_PROFILES_ADD_PERSON_BUTTON), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_ADD_USER), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_ADD_USER_WHITE)); + layout->StartRow(1, 0); + layout->AddView(add_user_button_); - layout->AddPaddingRow(0, views::kRelatedControlHorizontalSpacing); + users_button_ = new BackgroundColorHoverButton( + this, + l10n_util::GetStringUTF16(IDS_PROFILES_ALL_PEOPLE_BUTTON), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_ADD_USER), + *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_ADD_USER_WHITE)); layout->StartRow(1, 0); layout->AddView(users_button_); @@ -465,10 +559,10 @@ views::View* ProfileChooserView::CreateCurrentProfileAccountsView( DCHECK(avatar_item.signed_in); views::View* view = new views::View(); views::GridLayout* layout = CreateSingleColumnLayout(view); - layout->SetInsets(views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew, + layout->SetInsets(views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew, - views::kButtonVEdgeMarginNew); + views::kButtonVEdgeMarginNew, + views::kButtonHEdgeMarginNew); views::Label* email_label = new views::Label(avatar_item.sync_state); email_label->SetElideBehavior(views::Label::ELIDE_AS_EMAIL); @@ -478,7 +572,7 @@ views::View* ProfileChooserView::CreateCurrentProfileAccountsView( layout->StartRow(1, 0); layout->AddView(email_label); - layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing); + layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); views::BlueButton* add_account_button = new views::BlueButton( NULL, diff --git a/chrome/browser/ui/views/profile_chooser_view.h b/chrome/browser/ui/views/profile_chooser_view.h index 091dcb4..d045be3 100644 --- a/chrome/browser/ui/views/profile_chooser_view.h +++ b/chrome/browser/ui/views/profile_chooser_view.h @@ -86,8 +86,7 @@ class ProfileChooserView : public views::BubbleDelegateView, virtual void LinkClicked(views::Link* sender, int event_flags) OVERRIDE; // AvatarMenuObserver: - virtual void OnAvatarMenuChanged( - AvatarMenu* avatar_menu) OVERRIDE; + virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE; static ProfileChooserView* profile_bubble_; static bool close_on_deactivate_; @@ -129,6 +128,7 @@ class ProfileChooserView : public views::BubbleDelegateView, // Action buttons. views::TextButton* guest_button_; views::TextButton* end_guest_button_; + views::TextButton* add_user_button_; views::TextButton* users_button_; DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index 308d0fc..e0bb785 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc @@ -173,16 +173,10 @@ void UserManagerScreenHandler::HandleInitialize(const base::ListValue* args) { } void UserManagerScreenHandler::HandleAddUser(const base::ListValue* args) { - // TODO(noms): Should display the addUser page here, not do a redirect. Browser* browser = chrome::FindOrCreateTabbedBrowser( ProfileManager::GetLastUsedProfileAllowedByPolicy(), desktop_type_); DCHECK(browser); - chrome::NavigateParams params(browser, - GURL("chrome://settings/createProfile"), - content::PAGE_TRANSITION_LINK); - params.disposition = NEW_FOREGROUND_TAB; - params.window_action = chrome::NavigateParams::SHOW_WINDOW; - chrome::Navigate(¶ms); + profiles::CreateAndSwitchToNewProfile(desktop_type_); } void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) { diff --git a/ui/views/controls/menu/menu_win.cc b/ui/views/controls/menu/menu_win.cc index 2e5a4dc..d88659f 100644 --- a/ui/views/controls/menu/menu_win.cc +++ b/ui/views/controls/menu/menu_win.cc @@ -17,6 +17,7 @@ #include "ui/gfx/font.h" #include "ui/gfx/rect.h" #include "ui/gfx/win/window_impl.h" +#include "ui/views/layout/layout_constants.h" namespace views { @@ -29,8 +30,6 @@ const int kItemTopMargin = 3; const int kItemBottomMargin = 4; // Margins between the left of the item and the icon. const int kItemLeftMargin = 4; -// Margins between the right of the item and the label. -const int kItemRightMargin = 10; // The width for displaying the sub-menu arrow. const int kArrowWidth = 10; @@ -105,7 +104,7 @@ class MenuHostWindow : public gfx::WindowImpl { if (data != NULL) { gfx::Font font; lpmis->itemWidth = font.GetStringWidth(data->label) + kIconWidth + - kItemLeftMargin + kItemRightMargin - + kItemLeftMargin + views::kItemLabelSpacing - GetSystemMetrics(SM_CXMENUCHECK); if (data->submenu) lpmis->itemWidth += kArrowWidth; @@ -150,7 +149,7 @@ class MenuHostWindow : public gfx::WindowImpl { rect.top += kItemTopMargin; // Should we add kIconWidth only when icon.width() != 0 ? rect.left += kItemLeftMargin + kIconWidth; - rect.right -= kItemRightMargin; + rect.right -= views::kItemLabelSpacing; UINT format = DT_TOP | DT_SINGLELINE; // Check whether the mnemonics should be underlined. BOOL underline_mnemonics; diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc index 9349c69..c260af9 100644 --- a/ui/views/controls/menu/native_menu_win.cc +++ b/ui/views/controls/menu/native_menu_win.cc @@ -29,6 +29,7 @@ #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_insertion_delegate_win.h" #include "ui/views/controls/menu/menu_listener.h" +#include "ui/views/layout/layout_constants.h" using ui::NativeTheme; @@ -43,8 +44,6 @@ static const int kItemTopMargin = 3; static const int kItemBottomMargin = 4; // Margins between the left of the item and the icon. static const int kItemLeftMargin = 4; -// Margins between the right of the item and the label. -static const int kItemRightMargin = 10; // The width for displaying the sub-menu arrow. static const int kArrowWidth = 10; @@ -174,7 +173,7 @@ class NativeMenuWin::MenuHostWindow { if (data) { gfx::Font font; measure_item_struct->itemWidth = font.GetStringWidth(data->label) + - kIconWidth + kItemLeftMargin + kItemRightMargin - + kIconWidth + kItemLeftMargin + views::kItemLabelSpacing - GetSystemMetrics(SM_CXMENUCHECK); if (data->submenu.get()) measure_item_struct->itemWidth += kArrowWidth; @@ -219,7 +218,7 @@ class NativeMenuWin::MenuHostWindow { rect.top += kItemTopMargin; // Should we add kIconWidth only when icon.width() != 0 ? rect.left += kItemLeftMargin + kIconWidth; - rect.right -= kItemRightMargin; + rect.right -= views::kItemLabelSpacing; UINT format = DT_TOP | DT_SINGLELINE; // Check whether the mnemonics should be underlined. BOOL underline_mnemonics; diff --git a/ui/views/layout/layout_constants.h b/ui/views/layout/layout_constants.h index 3990acc..1cee4c0 100644 --- a/ui/views/layout/layout_constants.h +++ b/ui/views/layout/layout_constants.h @@ -76,6 +76,10 @@ const int kRelatedButtonHSpacing = 6; // Indent of checkboxes relative to related text. const int kCheckboxIndent = 10; +// Horizontal spacing between the end of an item (i.e. an icon or a checkbox) +// and the start of its corresponding text. +const int kItemLabelSpacing = 10; + } // namespace views #endif // UI_VIEWS_LAYOUT_LAYOUT_CONSTANTS_H_ |