| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 DIALOG_LAYOUT_APP_SHORTCUT | 51 DIALOG_LAYOUT_APP_SHORTCUT |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 explicit CreateApplicationShortcutView(Profile* profile); | 54 explicit CreateApplicationShortcutView(Profile* profile); |
| 55 virtual ~CreateApplicationShortcutView(); | 55 virtual ~CreateApplicationShortcutView(); |
| 56 | 56 |
| 57 // Initialize the controls on the dialog. | 57 // Initialize the controls on the dialog. |
| 58 void InitControls(DialogLayout dialog_layout); | 58 void InitControls(DialogLayout dialog_layout); |
| 59 | 59 |
| 60 // Overridden from views::View: | 60 // Overridden from views::View: |
| 61 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 61 virtual gfx::Size GetPreferredSize() const override; |
| 62 | 62 |
| 63 // Overridden from views::DialogDelegate: | 63 // Overridden from views::DialogDelegate: |
| 64 virtual base::string16 GetDialogButtonLabel( | 64 virtual base::string16 GetDialogButtonLabel( |
| 65 ui::DialogButton button) const OVERRIDE; | 65 ui::DialogButton button) const override; |
| 66 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 66 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 67 virtual ui::ModalType GetModalType() const OVERRIDE; | 67 virtual ui::ModalType GetModalType() const override; |
| 68 virtual base::string16 GetWindowTitle() const OVERRIDE; | 68 virtual base::string16 GetWindowTitle() const override; |
| 69 virtual bool Accept() OVERRIDE; | 69 virtual bool Accept() override; |
| 70 | 70 |
| 71 // Overridden from views::ButtonListener: | 71 // Overridden from views::ButtonListener: |
| 72 virtual void ButtonPressed(views::Button* sender, | 72 virtual void ButtonPressed(views::Button* sender, |
| 73 const ui::Event& event) OVERRIDE; | 73 const ui::Event& event) override; |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 // Adds a new check-box as a child to the view. | 76 // Adds a new check-box as a child to the view. |
| 77 views::Checkbox* AddCheckbox(const base::string16& text, bool checked); | 77 views::Checkbox* AddCheckbox(const base::string16& text, bool checked); |
| 78 | 78 |
| 79 // Profile in which the shortcuts will be created. | 79 // Profile in which the shortcuts will be created. |
| 80 Profile* profile_; | 80 Profile* profile_; |
| 81 | 81 |
| 82 // UI elements on the dialog. | 82 // UI elements on the dialog. |
| 83 // May be NULL if we are not displaying the app's info. | 83 // May be NULL if we are not displaying the app's info. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView); | 96 DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Create an application shortcut pointing to a URL. | 99 // Create an application shortcut pointing to a URL. |
| 100 class CreateUrlApplicationShortcutView : public CreateApplicationShortcutView { | 100 class CreateUrlApplicationShortcutView : public CreateApplicationShortcutView { |
| 101 public: | 101 public: |
| 102 explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents); | 102 explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents); |
| 103 virtual ~CreateUrlApplicationShortcutView(); | 103 virtual ~CreateUrlApplicationShortcutView(); |
| 104 | 104 |
| 105 virtual bool Accept() OVERRIDE; | 105 virtual bool Accept() override; |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 // Fetch the largest unprocessed icon. | 108 // Fetch the largest unprocessed icon. |
| 109 // The first largest icon downloaded and decoded successfully will be used. | 109 // The first largest icon downloaded and decoded successfully will be used. |
| 110 void FetchIcon(); | 110 void FetchIcon(); |
| 111 | 111 |
| 112 // Favicon download callback. | 112 // Favicon download callback. |
| 113 void DidDownloadFavicon( | 113 void DidDownloadFavicon( |
| 114 int requested_size, | 114 int requested_size, |
| 115 int id, | 115 int id, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 134 | 134 |
| 135 // Create an application shortcut pointing to a chrome application. | 135 // Create an application shortcut pointing to a chrome application. |
| 136 class CreateChromeApplicationShortcutView | 136 class CreateChromeApplicationShortcutView |
| 137 : public CreateApplicationShortcutView { | 137 : public CreateApplicationShortcutView { |
| 138 public: | 138 public: |
| 139 CreateChromeApplicationShortcutView( | 139 CreateChromeApplicationShortcutView( |
| 140 Profile* profile, | 140 Profile* profile, |
| 141 const extensions::Extension* app, | 141 const extensions::Extension* app, |
| 142 const base::Callback<void(bool)>& close_callback); | 142 const base::Callback<void(bool)>& close_callback); |
| 143 virtual ~CreateChromeApplicationShortcutView(); | 143 virtual ~CreateChromeApplicationShortcutView(); |
| 144 virtual bool Accept() OVERRIDE; | 144 virtual bool Accept() override; |
| 145 virtual bool Cancel() OVERRIDE; | 145 virtual bool Cancel() override; |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 // Called when the app's ShortcutInfo (with icon) and FileHandlersInfo is | 148 // Called when the app's ShortcutInfo (with icon) and FileHandlersInfo is |
| 149 // loaded. | 149 // loaded. |
| 150 void OnAppInfoLoaded(const web_app::ShortcutInfo& shortcut_info, | 150 void OnAppInfoLoaded(const web_app::ShortcutInfo& shortcut_info, |
| 151 const extensions::FileHandlersInfo& file_handlers_info); | 151 const extensions::FileHandlersInfo& file_handlers_info); |
| 152 | 152 |
| 153 base::Callback<void(bool)> close_callback_; | 153 base::Callback<void(bool)> close_callback_; |
| 154 | 154 |
| 155 base::WeakPtrFactory<CreateChromeApplicationShortcutView> weak_ptr_factory_; | 155 base::WeakPtrFactory<CreateChromeApplicationShortcutView> weak_ptr_factory_; |
| 156 | 156 |
| 157 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); | 157 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ | 160 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ |
| OLD | NEW |