Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.cc

Issue 1978403003: [MD] Eliminate as many SetStyle(STYLE_BUTTON) calls as possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.h" 5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser_dialogs.h" 8 #include "chrome/browser/ui/browser_dialogs.h"
9 #include "chrome/common/extensions/extension_constants.h" 9 #include "chrome/common/extensions/extension_constants.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "extensions/browser/extension_system.h" 11 #include "extensions/browser/extension_system.h"
12 #include "extensions/browser/management_policy.h" 12 #include "extensions/browser/management_policy.h"
13 #include "extensions/browser/uninstall_reason.h" 13 #include "extensions/browser/uninstall_reason.h"
14 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/events/event.h" 16 #include "ui/events/event.h"
17 #include "ui/views/controls/button/label_button.h" 17 #include "ui/views/controls/button/md_text_button.h"
18 #include "ui/views/layout/box_layout.h" 18 #include "ui/views/layout/box_layout.h"
19 #include "ui/views/layout/layout_constants.h" 19 #include "ui/views/layout/layout_constants.h"
20 #include "ui/views/view.h" 20 #include "ui/views/view.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 #if defined(USE_ASH) 23 #if defined(USE_ASH)
24 #include "ash/shelf/shelf_delegate.h" 24 #include "ash/shelf/shelf_delegate.h"
25 #include "ash/shell.h" 25 #include "ash/shell.h"
26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
27 #endif 27 #endif
(...skipping 16 matching lines...) Expand all
44 views::kRelatedButtonHSpacing)); 44 views::kRelatedButtonHSpacing));
45 45
46 LayoutButtons(); 46 LayoutButtons();
47 } 47 }
48 48
49 AppInfoFooterPanel::~AppInfoFooterPanel() { 49 AppInfoFooterPanel::~AppInfoFooterPanel() {
50 } 50 }
51 51
52 void AppInfoFooterPanel::CreateButtons() { 52 void AppInfoFooterPanel::CreateButtons() {
53 if (CanCreateShortcuts()) { 53 if (CanCreateShortcuts()) {
54 create_shortcuts_button_ = new views::LabelButton( 54 create_shortcuts_button_ = views::MdTextButton::CreateSecondaryUiButton(
55 this, 55 this, l10n_util::GetStringUTF16(
56 l10n_util::GetStringUTF16( 56 IDS_APPLICATION_INFO_CREATE_SHORTCUTS_BUTTON_TEXT));
57 IDS_APPLICATION_INFO_CREATE_SHORTCUTS_BUTTON_TEXT));
58 create_shortcuts_button_->SetStyle(views::Button::STYLE_BUTTON);
59 } 57 }
60 58
61 #if defined(USE_ASH) 59 #if defined(USE_ASH)
62 if (CanSetPinnedToShelf()) { 60 if (CanSetPinnedToShelf()) {
63 pin_to_shelf_button_ = new views::LabelButton( 61 pin_to_shelf_button_ = views::MdTextButton::CreateSecondaryUiButton(
64 this, l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN)); 62 this, l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN));
65 pin_to_shelf_button_->SetStyle(views::Button::STYLE_BUTTON); 63 unpin_from_shelf_button_ = views::MdTextButton::CreateSecondaryUiButton(
66 unpin_from_shelf_button_ = new views::LabelButton(
67 this, l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN)); 64 this, l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN));
68 unpin_from_shelf_button_->SetStyle(views::Button::STYLE_BUTTON);
69 } 65 }
70 #endif 66 #endif
71 67
72 if (CanUninstallApp()) { 68 if (CanUninstallApp()) {
73 remove_button_ = new views::LabelButton( 69 remove_button_ = views::MdTextButton::CreateSecondaryUiButton(
74 this, 70 this,
75 l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_UNINSTALL_BUTTON_TEXT)); 71 l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_UNINSTALL_BUTTON_TEXT));
76 remove_button_->SetStyle(views::Button::STYLE_BUTTON);
77 } 72 }
78 } 73 }
79 74
80 void AppInfoFooterPanel::LayoutButtons() { 75 void AppInfoFooterPanel::LayoutButtons() {
81 if (create_shortcuts_button_) 76 if (create_shortcuts_button_)
82 AddChildView(create_shortcuts_button_); 77 AddChildView(create_shortcuts_button_);
83 78
84 if (pin_to_shelf_button_) 79 if (pin_to_shelf_button_)
85 AddChildView(pin_to_shelf_button_); 80 AddChildView(pin_to_shelf_button_);
86 if (unpin_from_shelf_button_) 81 if (unpin_from_shelf_button_)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 app_, extensions::UNINSTALL_REASON_USER_INITIATED, 186 app_, extensions::UNINSTALL_REASON_USER_INITIATED,
192 extensions::UNINSTALL_SOURCE_APP_INFO_DIALOG); 187 extensions::UNINSTALL_SOURCE_APP_INFO_DIALOG);
193 } 188 }
194 189
195 bool AppInfoFooterPanel::CanUninstallApp() const { 190 bool AppInfoFooterPanel::CanUninstallApp() const {
196 extensions::ManagementPolicy* policy = 191 extensions::ManagementPolicy* policy =
197 extensions::ExtensionSystem::Get(profile_)->management_policy(); 192 extensions::ExtensionSystem::Get(profile_)->management_policy();
198 return policy->UserMayModifySettings(app_, nullptr) && 193 return policy->UserMayModifySettings(app_, nullptr) &&
199 !policy->MustRemainInstalled(app_, nullptr); 194 !policy->MustRemainInstalled(app_, nullptr);
200 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698