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