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

Side by Side Diff: chrome/browser/ui/cocoa/create_application_shortcut_cocoa.mm

Issue 2929733003: MacViews: Wire up CreateChromeApplicationShortcutView
Patch Set: rename ivar Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/bind.h"
7 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/cocoa/browser_dialogs_views_mac.h"
11 #include "chrome/browser/ui/cocoa/key_equivalent_constants.h"
8 #import "chrome/browser/web_applications/web_app_mac.h" 12 #import "chrome/browser/web_applications/web_app_mac.h"
9 #import "ui/base/l10n/l10n_util_mac.h"
10 #include "base/bind.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/cocoa/key_equivalent_constants.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "components/strings/grit/components_strings.h" 14 #include "components/strings/grit/components_strings.h"
15 #import "ui/base/l10n/l10n_util_mac.h"
16 #include "ui/base/material_design/material_design_controller.h"
15 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
16 18
17 @interface CrCreateAppShortcutCheckboxObserver : NSObject { 19 @interface CrCreateAppShortcutCheckboxObserver : NSObject {
18 @private 20 @private
19 NSButton* checkbox_; 21 NSButton* checkbox_;
20 NSButton* continueButton_; 22 NSButton* continueButton_;
21 } 23 }
22 24
23 - (id)initWithCheckbox:(NSButton*)checkbox 25 - (id)initWithCheckbox:(NSButton*)checkbox
24 continueButton:(NSButton*)continueButton; 26 continueButton:(NSButton*)continueButton;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_CANCEL)]; 75 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_CANCEL)];
74 [cancel_button setKeyEquivalent:kKeyEquivalentEscape]; 76 [cancel_button setKeyEquivalent:kKeyEquivalentEscape];
75 77
76 [alert setMessageText:l10n_util::GetNSString(IDS_CREATE_SHORTCUTS_LABEL)]; 78 [alert setMessageText:l10n_util::GetNSString(IDS_CREATE_SHORTCUTS_LABEL)];
77 [alert setAlertStyle:NSInformationalAlertStyle]; 79 [alert setAlertStyle:NSInformationalAlertStyle];
78 80
79 base::scoped_nsobject<NSButton> application_folder_checkbox( 81 base::scoped_nsobject<NSButton> application_folder_checkbox(
80 [[NSButton alloc] initWithFrame:NSZeroRect]); 82 [[NSButton alloc] initWithFrame:NSZeroRect]);
81 [application_folder_checkbox setButtonType:NSSwitchButton]; 83 [application_folder_checkbox setButtonType:NSSwitchButton];
82 [application_folder_checkbox 84 [application_folder_checkbox
83 setTitle:l10n_util::GetNSString(IDS_CREATE_SHORTCUTS_APP_FOLDER_CHKBOX)]; 85 setTitle:l10n_util::GetNSString(
86 IDS_CREATE_SHORTCUTS_APPLICATIONS_CHKBOX)];
84 [application_folder_checkbox setState:NSOnState]; 87 [application_folder_checkbox setState:NSOnState];
85 [application_folder_checkbox sizeToFit]; 88 [application_folder_checkbox sizeToFit];
86 89
87 base::scoped_nsobject<CrCreateAppShortcutCheckboxObserver> checkbox_observer( 90 base::scoped_nsobject<CrCreateAppShortcutCheckboxObserver> checkbox_observer(
88 [[CrCreateAppShortcutCheckboxObserver alloc] 91 [[CrCreateAppShortcutCheckboxObserver alloc]
89 initWithCheckbox:application_folder_checkbox 92 initWithCheckbox:application_folder_checkbox
90 continueButton:continue_button]); 93 continueButton:continue_button]);
91 [checkbox_observer startObserving]; 94 [checkbox_observer startObserving];
92 95
93 [alert setAccessoryView:application_folder_checkbox]; 96 [alert setAccessoryView:application_folder_checkbox];
(...skipping 22 matching lines...) Expand all
116 119
117 if (!close_callback.is_null()) 120 if (!close_callback.is_null())
118 close_callback.Run(dialog_accepted); 121 close_callback.Run(dialog_accepted);
119 } 122 }
120 123
121 } // namespace 124 } // namespace
122 125
123 namespace chrome { 126 namespace chrome {
124 127
125 void ShowCreateChromeAppShortcutsDialog( 128 void ShowCreateChromeAppShortcutsDialog(
126 gfx::NativeWindow /*parent_window*/, 129 gfx::NativeWindow parent_window,
127 Profile* profile, 130 Profile* profile,
128 const extensions::Extension* app, 131 const extensions::Extension* app,
129 const base::Callback<void(bool)>& close_callback) { 132 const base::Callback<void(bool)>& close_callback) {
133 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
134 ShowCreateChromeAppShortcutsDialogViews(parent_window, profile, app,
135 close_callback);
136 return;
137 }
138
130 web_app::GetShortcutInfoForApp( 139 web_app::GetShortcutInfoForApp(
131 app, profile, 140 app, profile,
132 base::Bind(&CreateAppShortcutInfoLoaded, profile, app, close_callback)); 141 base::Bind(&CreateAppShortcutInfoLoaded, profile, app, close_callback));
133 } 142 }
134 143
135 } // namespace chrome 144 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_dialogs_views_mac.cc ('k') | chrome/browser/ui/views/create_application_shortcut_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698