OLD | NEW |
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 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "chrome/browser/extensions/app_icon_loader.h" |
10 #include "chrome/common/web_application_info.h" | 11 #include "chrome/common/web_application_info.h" |
11 #include "ui/views/bubble/bubble_delegate.h" | 12 #include "ui/views/bubble/bubble_delegate.h" |
12 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
13 | 14 |
14 class Profile; | 15 class Profile; |
15 | 16 |
| 17 namespace extensions { |
| 18 class AppIconLoader; |
| 19 } |
| 20 |
| 21 namespace gfx { |
| 22 class ImageSkia; |
| 23 } |
| 24 |
16 namespace views { | 25 namespace views { |
17 class Checkbox; | 26 class Checkbox; |
| 27 class ImageView; |
18 class LabelButton; | 28 class LabelButton; |
19 class Textfield; | 29 class Textfield; |
20 } | 30 } |
21 | 31 |
22 // BookmarkAppBubbleView is a view intended to be used as the content of a | 32 // BookmarkAppBubbleView is a view intended to be used as the content of a |
23 // Bubble. BookmarkAppBubbleView provides views for editing the bookmark app it | 33 // Bubble. BookmarkAppBubbleView provides views for editing the bookmark app it |
24 // is created with. Don't create a BookmarkAppBubbleView directly, instead use | 34 // is created with. Don't create a BookmarkAppBubbleView directly, instead use |
25 // the static ShowBubble method. | 35 // the static ShowBubble method. |
26 class BookmarkAppBubbleView : public views::BubbleDelegateView, | 36 class BookmarkAppBubbleView : public views::BubbleDelegateView, |
27 public views::ButtonListener { | 37 public views::ButtonListener, |
| 38 public extensions::AppIconLoader::Delegate { |
28 public: | 39 public: |
29 virtual ~BookmarkAppBubbleView(); | 40 virtual ~BookmarkAppBubbleView(); |
30 | 41 |
31 static void ShowBubble(views::View* anchor_view, | 42 static void ShowBubble(views::View* anchor_view, |
32 Profile* profile, | 43 Profile* profile, |
33 const WebApplicationInfo& web_app_info, | 44 const WebApplicationInfo& web_app_info, |
34 const std::string& extension_id); | 45 const std::string& extension_id); |
35 | 46 |
36 private: | 47 private: |
37 // Creates a BookmarkAppBubbleView. | 48 // Creates a BookmarkAppBubbleView. |
(...skipping 11 matching lines...) Expand all Loading... |
49 | 60 |
50 // Overridden from views::View: | 61 // Overridden from views::View: |
51 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 62 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
52 virtual gfx::Size GetMinimumSize() OVERRIDE; | 63 virtual gfx::Size GetMinimumSize() OVERRIDE; |
53 | 64 |
54 // Overridden from views::ButtonListener: | 65 // Overridden from views::ButtonListener: |
55 // Closes the bubble or opens the edit dialog. | 66 // Closes the bubble or opens the edit dialog. |
56 virtual void ButtonPressed(views::Button* sender, | 67 virtual void ButtonPressed(views::Button* sender, |
57 const ui::Event& event) OVERRIDE; | 68 const ui::Event& event) OVERRIDE; |
58 | 69 |
| 70 // Overridden from extensions::AppIconLoader::Delegate: |
| 71 virtual void SetAppImage(const std::string& id, |
| 72 const gfx::ImageSkia& image) OVERRIDE; |
| 73 |
59 // Handle the message when the user presses a button. | 74 // Handle the message when the user presses a button. |
60 void HandleButtonPressed(views::Button* sender); | 75 void HandleButtonPressed(views::Button* sender); |
61 | 76 |
62 // Sets the title and launch type of the app. | 77 // Sets the title and launch type of the app. |
63 void ApplyEdits(); | 78 void ApplyEdits(); |
64 | 79 |
65 // The bookmark app bubble, if we're showing one. | 80 // The bookmark app bubble, if we're showing one. |
66 static BookmarkAppBubbleView* bookmark_app_bubble_; | 81 static BookmarkAppBubbleView* bookmark_app_bubble_; |
67 | 82 |
68 // The profile. | 83 // The profile. |
(...skipping 10 matching lines...) Expand all Loading... |
79 | 94 |
80 // Button to close the window. | 95 // Button to close the window. |
81 views::LabelButton* cancel_button_; | 96 views::LabelButton* cancel_button_; |
82 | 97 |
83 // Checkbox to launch as a tab. | 98 // Checkbox to launch as a tab. |
84 views::Checkbox* open_as_tab_checkbox_; | 99 views::Checkbox* open_as_tab_checkbox_; |
85 | 100 |
86 // Textfield showing the title of the app. | 101 // Textfield showing the title of the app. |
87 views::Textfield* title_tf_; | 102 views::Textfield* title_tf_; |
88 | 103 |
| 104 // Image showing the icon of the app. |
| 105 views::ImageView* icon_image_view_; |
| 106 |
89 // When the destructor is invoked should the app be removed? | 107 // When the destructor is invoked should the app be removed? |
90 bool remove_app_; | 108 bool remove_app_; |
91 | 109 |
| 110 // Used to load the icon. |
| 111 scoped_ptr<extensions::AppIconLoader> app_icon_loader_; |
| 112 |
92 DISALLOW_COPY_AND_ASSIGN(BookmarkAppBubbleView); | 113 DISALLOW_COPY_AND_ASSIGN(BookmarkAppBubbleView); |
93 }; | 114 }; |
94 | 115 |
95 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ |
OLD | NEW |