Views Omnibox: tolerate minor click-to-select-all dragging.
[chromium-blink-merge.git] / ui / app_list / views / folder_header_view.h
blobfb1183050545293529149a76c4463a6e847cf7c0
1 // Copyright (c) 2013 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.
5 #ifndef UI_APP_LIST_VIEWS_FOLDER_HEADER_VIEW_H_
6 #define UI_APP_LIST_VIEWS_FOLDER_HEADER_VIEW_H_
8 #include <string>
10 #include "ui/app_list/app_list_item_observer.h"
11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/textfield/textfield_controller.h"
13 #include "ui/views/view.h"
15 namespace views {
16 class ImageButton;
17 } // namespace views
19 namespace app_list {
21 class AppListFolderItem;
22 class AppListFolderView;
23 class FolderHeaderViewDelegate;
25 // FolderHeaderView contains a back button and an editable folder name field.
26 class FolderHeaderView : public views::View,
27 public views::TextfieldController,
28 public views::ButtonListener,
29 public AppListItemObserver {
30 public:
31 explicit FolderHeaderView(FolderHeaderViewDelegate* delegate);
32 virtual ~FolderHeaderView();
34 void SetFolderItem(AppListFolderItem* folder_item);
36 // Overridden from views::View:
37 virtual gfx::Size GetPreferredSize() OVERRIDE;
39 private:
40 class FolderNameView;
42 // Updates UI.
43 void Update();
45 // Overriden from views::View:
46 virtual void Layout() OVERRIDE;
47 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
49 // Overridden from views::TextfieldController:
50 virtual void ContentsChanged(views::Textfield* sender,
51 const base::string16& new_contents) OVERRIDE;
53 // Overridden from views::ButtonListener:
54 virtual void ButtonPressed(views::Button* sender,
55 const ui::Event& event) OVERRIDE;
57 // Overridden from AppListItemObserver:
58 virtual void ItemIconChanged() OVERRIDE;
59 virtual void ItemTitleChanged() OVERRIDE;
60 virtual void ItemHighlightedChanged() OVERRIDE;
61 virtual void ItemIsInstallingChanged() OVERRIDE;
62 virtual void ItemPercentDownloadedChanged() OVERRIDE;
64 AppListFolderItem* folder_item_; // Not owned.
66 views::ImageButton* back_button_; // Owned by views hierarchy.
67 FolderNameView* folder_name_view_; // Owned by views hierarchy.
69 FolderHeaderViewDelegate* delegate_;
71 DISALLOW_COPY_AND_ASSIGN(FolderHeaderView);
74 } // namespace app_list
76 #endif // UI_APP_LIST_VIEWS_FOLDER_HEADER_VIEW_H_