Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/ui/views/options/cookies_view.cc

Issue 6628037: views: Moves TextfieldController/TextRange into their own headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/views/options/cookies_view.h" 5 #include "chrome/browser/ui/views/options/cookies_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/views/appcache_info_view.h" 12 #include "chrome/browser/ui/views/appcache_info_view.h"
13 #include "chrome/browser/ui/views/cookie_info_view.h" 13 #include "chrome/browser/ui/views/cookie_info_view.h"
14 #include "chrome/browser/ui/views/database_info_view.h" 14 #include "chrome/browser/ui/views/database_info_view.h"
15 #include "chrome/browser/ui/views/indexed_db_info_view.h" 15 #include "chrome/browser/ui/views/indexed_db_info_view.h"
16 #include "chrome/browser/ui/views/local_storage_info_view.h" 16 #include "chrome/browser/ui/views/local_storage_info_view.h"
17 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
18 #include "grit/locale_settings.h" 18 #include "grit/locale_settings.h"
19 #include "net/base/cookie_monster.h" 19 #include "net/base/cookie_monster.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/color_utils.h" 22 #include "ui/gfx/color_utils.h"
23 #include "views/border.h" 23 #include "views/border.h"
24 #include "views/controls/button/native_button.h"
24 #include "views/controls/label.h" 25 #include "views/controls/label.h"
25 #include "views/controls/button/native_button.h" 26 #include "views/controls/textfield/textfield.h"
26 #include "views/controls/tree/tree_view.h" 27 #include "views/controls/tree/tree_view.h"
27 #include "views/controls/textfield/textfield.h"
28 #include "views/layout/grid_layout.h" 28 #include "views/layout/grid_layout.h"
29 #include "views/layout/layout_constants.h" 29 #include "views/layout/layout_constants.h"
30 30
31 // static 31 // static
32 views::Window* CookiesView::instance_ = NULL; 32 views::Window* CookiesView::instance_ = NULL;
33 static const int kSearchFilterDelayMs = 500; 33 static const int kSearchFilterDelayMs = 500;
34 34
35 /////////////////////////////////////////////////////////////////////////////// 35 ///////////////////////////////////////////////////////////////////////////////
36 // CookiesTreeView 36 // CookiesTreeView
37 // Overridden to handle Delete key presses 37 // Overridden to handle Delete key presses
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 UpdateForEmptyState(); 125 UpdateForEmptyState();
126 } else if (sender == remove_all_button_) { 126 } else if (sender == remove_all_button_) {
127 cookies_tree_model_->DeleteAllStoredObjects(); 127 cookies_tree_model_->DeleteAllStoredObjects();
128 UpdateForEmptyState(); 128 UpdateForEmptyState();
129 } else if (sender == clear_search_button_) { 129 } else if (sender == clear_search_button_) {
130 ResetSearchQuery(); 130 ResetSearchQuery();
131 } 131 }
132 } 132 }
133 133
134 /////////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////////
135 // CookiesView, views::Textfield::Controller implementation: 135 // CookiesView, views::TextfieldController implementation:
136 136
137 void CookiesView::ContentsChanged(views::Textfield* sender, 137 void CookiesView::ContentsChanged(views::Textfield* sender,
138 const std::wstring& new_contents) { 138 const std::wstring& new_contents) {
139 clear_search_button_->SetEnabled(!search_field_->text().empty()); 139 clear_search_button_->SetEnabled(!search_field_->text().empty());
140 search_update_factory_.RevokeAll(); 140 search_update_factory_.RevokeAll();
141 MessageLoop::current()->PostDelayedTask(FROM_HERE, 141 MessageLoop::current()->PostDelayedTask(FROM_HERE,
142 search_update_factory_.NewRunnableMethod( 142 search_update_factory_.NewRunnableMethod(
143 &CookiesView::UpdateSearchResults), kSearchFilterDelayMs); 143 &CookiesView::UpdateSearchResults), kSearchFilterDelayMs);
144 } 144 }
145 145
146 bool CookiesView::HandleKeyEvent(views::Textfield* sender, 146 bool CookiesView::HandleKeyEvent(views::Textfield* sender,
147 const views::KeyEvent& key_event) { 147 const views::KeyEvent& key_event) {
148 if (key_event.key_code() == ui::VKEY_ESCAPE) { 148 if (key_event.key_code() == ui::VKEY_ESCAPE) {
149 ResetSearchQuery(); 149 ResetSearchQuery();
150 } else if (key_event.key_code() == ui::VKEY_RETURN) { 150 } else if (key_event.key_code() == ui::VKEY_RETURN) {
151 search_update_factory_.RevokeAll(); 151 search_update_factory_.RevokeAll();
152 UpdateSearchResults(); 152 UpdateSearchResults();
153 } 153 }
154 return false; 154 return false;
155 } 155 }
156 156
157 /////////////////////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////////////////////
158 // CookiesView, views::DialogDelegate implementation: 158 // CookiesView, views::DialogDelegate implementation:
159 159
160 int CookiesView::GetDialogButtons() const {
161 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
162 }
163
164 views::View* CookiesView::GetInitiallyFocusedView() {
165 return search_field_;
166 }
167
168 bool CookiesView::CanResize() const {
169 return true;
170 }
171
160 std::wstring CookiesView::GetWindowTitle() const { 172 std::wstring CookiesView::GetWindowTitle() const {
161 return UTF16ToWide( 173 return UTF16ToWide(
162 l10n_util::GetStringUTF16(IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE)); 174 l10n_util::GetStringUTF16(IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE));
163 } 175 }
164 176
165 void CookiesView::WindowClosing() { 177 void CookiesView::WindowClosing() {
166 instance_ = NULL; 178 instance_ = NULL;
167 } 179 }
168 180
169 views::View* CookiesView::GetContentsView() { 181 views::View* CookiesView::GetContentsView() {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 GetTotalNodeCount() > 1); 403 GetTotalNodeCount() > 1);
392 } 404 }
393 405
394 void CookiesView::UpdateVisibleDetailedInfo(views::View* view) { 406 void CookiesView::UpdateVisibleDetailedInfo(views::View* view) {
395 cookie_info_view_->SetVisible(view == cookie_info_view_); 407 cookie_info_view_->SetVisible(view == cookie_info_view_);
396 database_info_view_->SetVisible(view == database_info_view_); 408 database_info_view_->SetVisible(view == database_info_view_);
397 local_storage_info_view_->SetVisible(view == local_storage_info_view_); 409 local_storage_info_view_->SetVisible(view == local_storage_info_view_);
398 appcache_info_view_->SetVisible(view == appcache_info_view_); 410 appcache_info_view_->SetVisible(view == appcache_info_view_);
399 indexed_db_info_view_->SetVisible(view == indexed_db_info_view_); 411 indexed_db_info_view_->SetVisible(view == indexed_db_info_view_);
400 } 412 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/options/cookies_view.h ('k') | chrome/browser/ui/views/options/exception_editor_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698