OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
7 | 7 |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "views/controls/button/button.h" | 9 #include "views/controls/button/button.h" |
10 #include "views/controls/table/table_view.h" | 10 #include "views/controls/table/table_view.h" |
11 #include "views/controls/text_field.h" | 11 #include "views/controls/textfield/textfield.h" |
12 #include "views/view.h" | 12 #include "views/view.h" |
13 #include "views/window/dialog_delegate.h" | 13 #include "views/window/dialog_delegate.h" |
14 #include "views/window/window.h" | 14 #include "views/window/window.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class Label; | 17 class Label; |
18 class NativeButton; | 18 class NativeButton; |
19 } | 19 } |
20 class CookieInfoView; | 20 class CookieInfoView; |
21 class CookiesTableModel; | 21 class CookiesTableModel; |
22 class CookiesTableView; | 22 class CookiesTableView; |
23 class Profile; | 23 class Profile; |
24 class Timer; | 24 class Timer; |
25 | 25 |
26 class CookiesView : public views::View, | 26 class CookiesView : public views::View, |
27 public views::DialogDelegate, | 27 public views::DialogDelegate, |
28 public views::ButtonListener, | 28 public views::ButtonListener, |
29 public views::TableViewObserver, | 29 public views::TableViewObserver, |
30 public views::TextField::Controller { | 30 public views::Textfield::Controller { |
31 public: | 31 public: |
32 // Show the Cookies Window, creating one if necessary. | 32 // Show the Cookies Window, creating one if necessary. |
33 static void ShowCookiesWindow(Profile* profile); | 33 static void ShowCookiesWindow(Profile* profile); |
34 | 34 |
35 virtual ~CookiesView(); | 35 virtual ~CookiesView(); |
36 | 36 |
37 // Updates the display to show only the search results. | 37 // Updates the display to show only the search results. |
38 void UpdateSearchResults(); | 38 void UpdateSearchResults(); |
39 | 39 |
40 // views::ButtonListener implementation: | 40 // views::ButtonListener implementation: |
41 virtual void ButtonPressed(views::Button* sender); | 41 virtual void ButtonPressed(views::Button* sender); |
42 | 42 |
43 // views::TableViewObserver implementation: | 43 // views::TableViewObserver implementation: |
44 virtual void OnSelectionChanged(); | 44 virtual void OnSelectionChanged(); |
45 | 45 |
46 // Invoked when the user presses the delete key. Deletes the selected | 46 // Invoked when the user presses the delete key. Deletes the selected |
47 // cookies. | 47 // cookies. |
48 virtual void OnTableViewDelete(views::TableView* table_view); | 48 virtual void OnTableViewDelete(views::TableView* table_view); |
49 | 49 |
50 // views::TextField::Controller implementation: | 50 // views::Textfield::Controller implementation: |
51 virtual void ContentsChanged(views::TextField* sender, | 51 virtual void ContentsChanged(views::Textfield* sender, |
52 const std::wstring& new_contents); | 52 const std::wstring& new_contents); |
53 virtual bool HandleKeystroke(views::TextField* sender, | 53 virtual bool HandleKeystroke(views::Textfield* sender, |
54 const views::TextField::Keystroke& key); | 54 const views::Textfield::Keystroke& key); |
55 | 55 |
56 // views::WindowDelegate implementation: | 56 // views::WindowDelegate implementation: |
57 virtual int GetDialogButtons() const { | 57 virtual int GetDialogButtons() const { |
58 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 58 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
59 } | 59 } |
60 virtual views::View* GetInitiallyFocusedView() { | 60 virtual views::View* GetInitiallyFocusedView() { |
61 return search_field_; | 61 return search_field_; |
62 } | 62 } |
63 virtual bool CanResize() const { return true; } | 63 virtual bool CanResize() const { return true; } |
64 virtual std::wstring GetWindowTitle() const; | 64 virtual std::wstring GetWindowTitle() const; |
(...skipping 18 matching lines...) Expand all Loading... |
83 void Init(); | 83 void Init(); |
84 | 84 |
85 // Resets the display to what it would be if there were no search query. | 85 // Resets the display to what it would be if there were no search query. |
86 void ResetSearchQuery(); | 86 void ResetSearchQuery(); |
87 | 87 |
88 // Update the UI when there are no cookies. | 88 // Update the UI when there are no cookies. |
89 void UpdateForEmptyState(); | 89 void UpdateForEmptyState(); |
90 | 90 |
91 // Assorted dialog controls | 91 // Assorted dialog controls |
92 views::Label* search_label_; | 92 views::Label* search_label_; |
93 views::TextField* search_field_; | 93 views::Textfield* search_field_; |
94 views::NativeButton* clear_search_button_; | 94 views::NativeButton* clear_search_button_; |
95 views::Label* description_label_; | 95 views::Label* description_label_; |
96 CookiesTableView* cookies_table_; | 96 CookiesTableView* cookies_table_; |
97 CookieInfoView* info_view_; | 97 CookieInfoView* info_view_; |
98 views::NativeButton* remove_button_; | 98 views::NativeButton* remove_button_; |
99 views::NativeButton* remove_all_button_; | 99 views::NativeButton* remove_all_button_; |
100 | 100 |
101 // The Cookies Table model | 101 // The Cookies Table model |
102 scoped_ptr<CookiesTableModel> cookies_table_model_; | 102 scoped_ptr<CookiesTableModel> cookies_table_model_; |
103 scoped_ptr<CookiesTableModel> search_table_model_; | 103 scoped_ptr<CookiesTableModel> search_table_model_; |
104 | 104 |
105 // The Profile for which Cookies are displayed | 105 // The Profile for which Cookies are displayed |
106 Profile* profile_; | 106 Profile* profile_; |
107 | 107 |
108 // A factory to construct Runnable Methods so that we can be called back to | 108 // A factory to construct Runnable Methods so that we can be called back to |
109 // re-evaluate the model after the search query string changes. | 109 // re-evaluate the model after the search query string changes. |
110 ScopedRunnableMethodFactory<CookiesView> search_update_factory_; | 110 ScopedRunnableMethodFactory<CookiesView> search_update_factory_; |
111 | 111 |
112 // Our containing window. If this is non-NULL there is a visible Cookies | 112 // Our containing window. If this is non-NULL there is a visible Cookies |
113 // window somewhere. | 113 // window somewhere. |
114 static views::Window* instance_; | 114 static views::Window* instance_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(CookiesView); | 116 DISALLOW_COPY_AND_ASSIGN(CookiesView); |
117 }; | 117 }; |
118 | 118 |
119 #endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 119 #endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
OLD | NEW |