OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
11 #include "ui/views/controls/link_listener.h" | 11 #include "ui/views/controls/link_listener.h" |
12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
13 | 13 |
| 14 namespace chrome { |
| 15 class BookmarkBarInstructionsDelegate; |
| 16 } |
14 namespace views { | 17 namespace views { |
15 class Label; | 18 class Label; |
16 class Link; | 19 class Link; |
17 } | 20 } |
18 | 21 |
19 // BookmarkBarInstructionsView is a child of the bookmark bar that is visible | 22 // BookmarkBarInstructionsView is a child of the bookmark bar that is visible |
20 // when the user has no bookmarks on the bookmark bar. | 23 // when the user has no bookmarks on the bookmark bar. |
21 // BookmarkBarInstructionsView shows a description of the bookmarks bar along | 24 // BookmarkBarInstructionsView shows a description of the bookmarks bar along |
22 // with a link to import bookmarks. Clicking the link results in notifying the | 25 // with a link to import bookmarks. Clicking the link results in notifying the |
23 // delegate. | 26 // delegate. |
24 class BookmarkBarInstructionsView : public views::View, | 27 class BookmarkBarInstructionsView : public views::View, |
25 public views::LinkListener { | 28 public views::LinkListener { |
26 public: | 29 public: |
27 // The delegate is notified once the user clicks on the link to import | 30 explicit BookmarkBarInstructionsView( |
28 // bookmarks. | 31 chrome::BookmarkBarInstructionsDelegate* delegate); |
29 class Delegate { | |
30 public: | |
31 virtual void ShowImportDialog() = 0; | |
32 | |
33 protected: | |
34 virtual ~Delegate() {} | |
35 }; | |
36 | |
37 explicit BookmarkBarInstructionsView(Delegate* delegate); | |
38 | 32 |
39 // views::View overrides. | 33 // views::View overrides. |
40 virtual gfx::Size GetPreferredSize() OVERRIDE; | 34 virtual gfx::Size GetPreferredSize() OVERRIDE; |
41 virtual void Layout() OVERRIDE; | 35 virtual void Layout() OVERRIDE; |
42 virtual void OnThemeChanged() OVERRIDE; | 36 virtual void OnThemeChanged() OVERRIDE; |
43 virtual void ViewHierarchyChanged(bool is_add, | 37 virtual void ViewHierarchyChanged(bool is_add, |
44 views::View* parent, | 38 views::View* parent, |
45 views::View* child) OVERRIDE; | 39 views::View* child) OVERRIDE; |
46 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 40 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
47 | 41 |
48 // views::LinkListener overrides. | 42 // views::LinkListener overrides. |
49 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 43 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
50 | 44 |
51 private: | 45 private: |
52 void UpdateColors(); | 46 void UpdateColors(); |
53 | 47 |
54 Delegate* delegate_; | 48 chrome::BookmarkBarInstructionsDelegate* delegate_; |
55 | 49 |
56 views::Label* instructions_; | 50 views::Label* instructions_; |
57 views::Link* import_link_; | 51 views::Link* import_link_; |
58 | 52 |
59 // The baseline of the child views. This is -1 if none of the views support a | 53 // The baseline of the child views. This is -1 if none of the views support a |
60 // baseline. | 54 // baseline. |
61 int baseline_; | 55 int baseline_; |
62 | 56 |
63 // Have the colors of the child views been updated? This is initially false | 57 // Have the colors of the child views been updated? This is initially false |
64 // and set to true once we have a valid ThemeProvider. | 58 // and set to true once we have a valid ThemeProvider. |
65 bool updated_colors_; | 59 bool updated_colors_; |
66 | 60 |
67 DISALLOW_COPY_AND_ASSIGN(BookmarkBarInstructionsView); | 61 DISALLOW_COPY_AND_ASSIGN(BookmarkBarInstructionsView); |
68 }; | 62 }; |
69 | 63 |
70 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ | 64 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ |
OLD | NEW |