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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "chrome/browser/browsing_data_local_storage_helper.h" |
11 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
12 #include "views/controls/button/button.h" | 13 #include "views/controls/button/button.h" |
13 #include "views/controls/tree/tree_view.h" | 14 #include "views/controls/tree/tree_view.h" |
14 #include "views/controls/textfield/textfield.h" | 15 #include "views/controls/textfield/textfield.h" |
15 #include "views/view.h" | 16 #include "views/view.h" |
16 #include "views/window/dialog_delegate.h" | 17 #include "views/window/dialog_delegate.h" |
17 #include "views/window/window.h" | 18 #include "views/window/window.h" |
18 | 19 |
19 namespace views { | 20 namespace views { |
20 | 21 |
21 class Label; | 22 class Label; |
22 class NativeButton; | 23 class NativeButton; |
23 | 24 |
24 } // namespace views | 25 } // namespace views |
25 | 26 |
26 | 27 |
| 28 class BrowsingDataLocalStorageHelper; |
27 class CookieInfoView; | 29 class CookieInfoView; |
28 class CookiesTreeModel; | 30 class CookiesTreeModel; |
29 class CookiesTreeView; | 31 class CookiesTreeView; |
| 32 class LocalStorageInfoView; |
30 class Profile; | 33 class Profile; |
31 class Timer; | 34 class Timer; |
32 | 35 |
33 | 36 |
34 class CookiesView : public views::View, | 37 class CookiesView : public views::View, |
35 public views::DialogDelegate, | 38 public views::DialogDelegate, |
36 public views::ButtonListener, | 39 public views::ButtonListener, |
37 public views::TreeViewController, | 40 public views::TreeViewController, |
38 public views::Textfield::Controller { | 41 public views::Textfield::Controller { |
39 public: | 42 public: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 92 |
90 // Initialize the dialog contents and layout. | 93 // Initialize the dialog contents and layout. |
91 void Init(); | 94 void Init(); |
92 | 95 |
93 // Resets the display to what it would be if there were no search query. | 96 // Resets the display to what it would be if there were no search query. |
94 void ResetSearchQuery(); | 97 void ResetSearchQuery(); |
95 | 98 |
96 // Update the UI when there are no cookies. | 99 // Update the UI when there are no cookies. |
97 void UpdateForEmptyState(); | 100 void UpdateForEmptyState(); |
98 | 101 |
| 102 // Update the UI when a cookie is selected. |
| 103 void UpdateForCookieState(); |
| 104 |
| 105 // Update the UI when a local storage is selected. |
| 106 void UpdateForLocalStorageState(); |
| 107 |
| 108 // Updates view to be visible inside detailed_info_view_; |
| 109 void UpdateVisibleDetailedInfo(views::View* view); |
| 110 |
99 // Assorted dialog controls | 111 // Assorted dialog controls |
100 views::Label* search_label_; | 112 views::Label* search_label_; |
101 views::Textfield* search_field_; | 113 views::Textfield* search_field_; |
102 views::NativeButton* clear_search_button_; | 114 views::NativeButton* clear_search_button_; |
103 views::Label* description_label_; | 115 views::Label* description_label_; |
104 CookiesTreeView* cookies_tree_; | 116 CookiesTreeView* cookies_tree_; |
105 CookieInfoView* info_view_; | 117 CookieInfoView* cookie_info_view_; |
| 118 LocalStorageInfoView* local_storage_info_view_; |
106 views::NativeButton* remove_button_; | 119 views::NativeButton* remove_button_; |
107 views::NativeButton* remove_all_button_; | 120 views::NativeButton* remove_all_button_; |
108 | 121 |
109 // The Cookies Tree model | 122 // The Cookies Tree model |
110 scoped_ptr<CookiesTreeModel> cookies_tree_model_; | 123 scoped_ptr<CookiesTreeModel> cookies_tree_model_; |
111 | 124 |
112 // The Profile for which Cookies are displayed | 125 // The Profile for which Cookies are displayed |
113 Profile* profile_; | 126 Profile* profile_; |
114 | 127 |
115 // A factory to construct Runnable Methods so that we can be called back to | 128 // A factory to construct Runnable Methods so that we can be called back to |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 views::Label* send_for_label_; | 178 views::Label* send_for_label_; |
166 views::Textfield* send_for_value_field_; | 179 views::Textfield* send_for_value_field_; |
167 views::Label* created_label_; | 180 views::Label* created_label_; |
168 views::Textfield* created_value_field_; | 181 views::Textfield* created_value_field_; |
169 views::Label* expires_label_; | 182 views::Label* expires_label_; |
170 views::Textfield* expires_value_field_; | 183 views::Textfield* expires_value_field_; |
171 | 184 |
172 DISALLOW_COPY_AND_ASSIGN(CookieInfoView); | 185 DISALLOW_COPY_AND_ASSIGN(CookieInfoView); |
173 }; | 186 }; |
174 | 187 |
| 188 /////////////////////////////////////////////////////////////////////////////// |
| 189 // LocalStorageInfoView |
| 190 // |
| 191 // Responsible for displaying a tabular grid of Local Storage information. |
| 192 class LocalStorageInfoView : public views::View { |
| 193 public: |
| 194 LocalStorageInfoView(); |
| 195 virtual ~LocalStorageInfoView(); |
| 196 |
| 197 // Update the display from the specified Local Storage info. |
| 198 void SetLocalStorageInfo( |
| 199 const BrowsingDataLocalStorageHelper::LocalStorageInfo& |
| 200 local_storage_info); |
| 201 |
| 202 // Clears the cookie display to indicate that no or multiple local storages |
| 203 // are selected. |
| 204 void ClearLocalStorageDisplay(); |
| 205 |
| 206 // Enables or disables the local storate property text fields. |
| 207 void EnableLocalStorageDisplay(bool enabled); |
| 208 |
| 209 protected: |
| 210 // views::View overrides: |
| 211 virtual void ViewHierarchyChanged( |
| 212 bool is_add, views::View* parent, views::View* child); |
| 213 |
| 214 private: |
| 215 // Set up the view layout |
| 216 void Init(); |
| 217 |
| 218 // Individual property labels |
| 219 views::Label* origin_label_; |
| 220 views::Textfield* origin_value_field_; |
| 221 views::Label* size_label_; |
| 222 views::Textfield* size_value_field_; |
| 223 views::Label* last_modified_label_; |
| 224 views::Textfield* last_modified_value_field_; |
| 225 |
| 226 DISALLOW_COPY_AND_ASSIGN(LocalStorageInfoView); |
| 227 }; |
| 228 |
| 229 |
175 #endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 230 #endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
OLD | NEW |