OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... | |
33 } | 33 } |
34 | 34 |
35 // CreateShortcutViewCommon implements a dialog that asks user where to create | 35 // CreateShortcutViewCommon implements a dialog that asks user where to create |
36 // the shortcut for given web app. There are two variants of this dialog: | 36 // the shortcut for given web app. There are two variants of this dialog: |
37 // Shortcuts that load a URL in an app-like window, and shortcuts that load | 37 // Shortcuts that load a URL in an app-like window, and shortcuts that load |
38 // a chrome app (the kind you see under "apps" on the new tabs page) in an app | 38 // a chrome app (the kind you see under "apps" on the new tabs page) in an app |
39 // window. These are implemented as subclasses of CreateShortcutViewCommon. | 39 // window. These are implemented as subclasses of CreateShortcutViewCommon. |
40 class CreateApplicationShortcutView : public views::DialogDelegateView, | 40 class CreateApplicationShortcutView : public views::DialogDelegateView, |
41 public views::ButtonListener { | 41 public views::ButtonListener { |
42 public: | 42 public: |
43 enum DialogLayout { | |
44 // URL shortcuts have an info frame at the top with a thumbnail, title and | |
45 // description. | |
46 URL_SHORTCUT_LAYOUT, | |
sky
2014/06/03 17:14:12
Follow naming convention for content, eg DIALOG_LA
sashab
2014/06/11 05:53:13
Done.
| |
47 | |
48 // App shortcuts don't have an info frame, since they are launched from | |
49 // places where it's clear what app they are from. | |
50 APP_SHORTCUT_LAYOUT | |
51 }; | |
52 | |
43 explicit CreateApplicationShortcutView(Profile* profile); | 53 explicit CreateApplicationShortcutView(Profile* profile); |
44 virtual ~CreateApplicationShortcutView(); | 54 virtual ~CreateApplicationShortcutView(); |
45 | 55 |
46 // Initialize the controls on the dialog. | 56 // Initialize the controls on the dialog. |
47 void InitControls(); | 57 void InitControls(enum DialogLayout dialog_layout); |
sky
2014/06/03 17:14:12
no enum here.
sashab
2014/06/11 05:53:13
Done.
| |
48 | 58 |
49 // Overridden from views::View: | 59 // Overridden from views::View: |
50 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 60 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
51 | 61 |
52 // Overridden from views::DialogDelegate: | 62 // Overridden from views::DialogDelegate: |
53 virtual base::string16 GetDialogButtonLabel( | 63 virtual base::string16 GetDialogButtonLabel( |
54 ui::DialogButton button) const OVERRIDE; | 64 ui::DialogButton button) const OVERRIDE; |
55 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 65 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
56 virtual ui::ModalType GetModalType() const OVERRIDE; | 66 virtual ui::ModalType GetModalType() const OVERRIDE; |
57 virtual base::string16 GetWindowTitle() const OVERRIDE; | 67 virtual base::string16 GetWindowTitle() const OVERRIDE; |
58 virtual bool Accept() OVERRIDE; | 68 virtual bool Accept() OVERRIDE; |
59 | 69 |
60 // Overridden from views::ButtonListener: | 70 // Overridden from views::ButtonListener: |
61 virtual void ButtonPressed(views::Button* sender, | 71 virtual void ButtonPressed(views::Button* sender, |
62 const ui::Event& event) OVERRIDE; | 72 const ui::Event& event) OVERRIDE; |
63 | 73 |
64 protected: | 74 protected: |
65 // Adds a new check-box as a child to the view. | 75 // Adds a new check-box as a child to the view. |
66 views::Checkbox* AddCheckbox(const base::string16& text, bool checked); | 76 views::Checkbox* AddCheckbox(const base::string16& text, bool checked); |
67 | 77 |
68 // Profile in which the shortcuts will be created. | 78 // Profile in which the shortcuts will be created. |
69 Profile* profile_; | 79 Profile* profile_; |
70 | 80 |
71 // UI elements on the dialog. | 81 // UI elements on the dialog. |
72 views::View* app_info_; | 82 views::View* app_info_; |
sky
2014/06/03 17:14:12
Document this may be NULL.
sashab
2014/06/11 05:53:13
Done.
| |
73 views::Label* create_shortcuts_label_; | 83 views::Label* create_shortcuts_label_; |
74 views::Checkbox* desktop_check_box_; | 84 views::Checkbox* desktop_check_box_; |
75 views::Checkbox* menu_check_box_; | 85 views::Checkbox* menu_check_box_; |
76 views::Checkbox* quick_launch_check_box_; | 86 views::Checkbox* quick_launch_check_box_; |
77 | 87 |
78 // Target shortcut info. | 88 // Target shortcut info. |
79 web_app::ShortcutInfo shortcut_info_; | 89 web_app::ShortcutInfo shortcut_info_; |
80 // If false, the shortcut will be created in the root level of the Start Menu. | 90 // If false, the shortcut will be created in the root level of the Start Menu. |
81 bool create_in_chrome_apps_subdir_; | 91 bool create_in_chrome_apps_subdir_; |
82 | 92 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 public: | 135 public: |
126 CreateChromeApplicationShortcutView( | 136 CreateChromeApplicationShortcutView( |
127 Profile* profile, | 137 Profile* profile, |
128 const extensions::Extension* app, | 138 const extensions::Extension* app, |
129 const base::Callback<void(bool)>& close_callback); | 139 const base::Callback<void(bool)>& close_callback); |
130 virtual ~CreateChromeApplicationShortcutView(); | 140 virtual ~CreateChromeApplicationShortcutView(); |
131 virtual bool Accept() OVERRIDE; | 141 virtual bool Accept() OVERRIDE; |
132 virtual bool Cancel() OVERRIDE; | 142 virtual bool Cancel() OVERRIDE; |
133 | 143 |
134 private: | 144 private: |
135 void OnShortcutInfoLoaded( | |
136 const web_app::ShortcutInfo& shortcut_info); | |
137 | |
138 base::Callback<void(bool)> close_callback_; | 145 base::Callback<void(bool)> close_callback_; |
139 | 146 |
140 base::WeakPtrFactory<CreateChromeApplicationShortcutView> weak_ptr_factory_; | 147 base::WeakPtrFactory<CreateChromeApplicationShortcutView> weak_ptr_factory_; |
141 | 148 |
142 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); | 149 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); |
143 }; | 150 }; |
144 | 151 |
145 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ | 152 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ |
OLD | NEW |