| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 #include <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "chrome/browser/views/options/cookies_view.h" | 7 #include "chrome/browser/views/options/cookies_view.h" |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/time_format.h" | 10 #include "base/time_format.h" |
| 11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // The profile from which this model sources cookies. | 68 // The profile from which this model sources cookies. |
| 69 Profile* profile_; | 69 Profile* profile_; |
| 70 | 70 |
| 71 typedef net::CookieMonster::CookieList CookieList; | 71 typedef net::CookieMonster::CookieList CookieList; |
| 72 typedef std::vector<net::CookieMonster::CookieListPair*> CookiePtrList; | 72 typedef std::vector<net::CookieMonster::CookieListPair*> CookiePtrList; |
| 73 CookieList all_cookies_; | 73 CookieList all_cookies_; |
| 74 CookiePtrList shown_cookies_; | 74 CookiePtrList shown_cookies_; |
| 75 | 75 |
| 76 views::TableModelObserver* observer_; | 76 views::TableModelObserver* observer_; |
| 77 | 77 |
| 78 DISALLOW_EVIL_CONSTRUCTORS(CookiesTableModel); | 78 DISALLOW_COPY_AND_ASSIGN(CookiesTableModel); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 /////////////////////////////////////////////////////////////////////////////// | 81 /////////////////////////////////////////////////////////////////////////////// |
| 82 // CookiesTableModel, public: | 82 // CookiesTableModel, public: |
| 83 | 83 |
| 84 CookiesTableModel::CookiesTableModel(Profile* profile) | 84 CookiesTableModel::CookiesTableModel(Profile* profile) |
| 85 : profile_(profile) { | 85 : profile_(profile) { |
| 86 LoadCookies(); | 86 LoadCookies(); |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 std::vector<views::TableColumn> columns); | 257 std::vector<views::TableColumn> columns); |
| 258 virtual ~CookiesTableView() {} | 258 virtual ~CookiesTableView() {} |
| 259 | 259 |
| 260 // Removes the cookies associated with the selected rows in the TableView. | 260 // Removes the cookies associated with the selected rows in the TableView. |
| 261 void RemoveSelectedCookies(); | 261 void RemoveSelectedCookies(); |
| 262 | 262 |
| 263 private: | 263 private: |
| 264 // Our model, as a CookiesTableModel. | 264 // Our model, as a CookiesTableModel. |
| 265 CookiesTableModel* cookies_model_; | 265 CookiesTableModel* cookies_model_; |
| 266 | 266 |
| 267 DISALLOW_EVIL_CONSTRUCTORS(CookiesTableView); | 267 DISALLOW_COPY_AND_ASSIGN(CookiesTableView); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 CookiesTableView::CookiesTableView( | 270 CookiesTableView::CookiesTableView( |
| 271 CookiesTableModel* cookies_model, | 271 CookiesTableModel* cookies_model, |
| 272 std::vector<views::TableColumn> columns) | 272 std::vector<views::TableColumn> columns) |
| 273 : views::TableView(cookies_model, columns, views::ICON_AND_TEXT, false, | 273 : views::TableView(cookies_model, columns, views::ICON_AND_TEXT, false, |
| 274 true, true), | 274 true, true), |
| 275 cookies_model_(cookies_model) { | 275 cookies_model_(cookies_model) { |
| 276 } | 276 } |
| 277 | 277 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 views::TextField* domain_value_field_; | 346 views::TextField* domain_value_field_; |
| 347 views::Label* path_label_; | 347 views::Label* path_label_; |
| 348 views::TextField* path_value_field_; | 348 views::TextField* path_value_field_; |
| 349 views::Label* send_for_label_; | 349 views::Label* send_for_label_; |
| 350 views::TextField* send_for_value_field_; | 350 views::TextField* send_for_value_field_; |
| 351 views::Label* created_label_; | 351 views::Label* created_label_; |
| 352 views::TextField* created_value_field_; | 352 views::TextField* created_value_field_; |
| 353 views::Label* expires_label_; | 353 views::Label* expires_label_; |
| 354 views::TextField* expires_value_field_; | 354 views::TextField* expires_value_field_; |
| 355 | 355 |
| 356 DISALLOW_EVIL_CONSTRUCTORS(CookieInfoView); | 356 DISALLOW_COPY_AND_ASSIGN(CookieInfoView); |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 /////////////////////////////////////////////////////////////////////////////// | 359 /////////////////////////////////////////////////////////////////////////////// |
| 360 // CookieInfoView, public: | 360 // CookieInfoView, public: |
| 361 | 361 |
| 362 CookieInfoView::CookieInfoView() | 362 CookieInfoView::CookieInfoView() |
| 363 : name_label_(NULL), | 363 : name_label_(NULL), |
| 364 name_value_field_(NULL), | 364 name_value_field_(NULL), |
| 365 content_label_(NULL), | 365 content_label_(NULL), |
| 366 content_value_field_(NULL), | 366 content_value_field_(NULL), |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 // CookiesView, views::TextField::Controller implementation: | 613 // CookiesView, views::TextField::Controller implementation: |
| 614 | 614 |
| 615 void CookiesView::ContentsChanged(views::TextField* sender, | 615 void CookiesView::ContentsChanged(views::TextField* sender, |
| 616 const std::wstring& new_contents) { | 616 const std::wstring& new_contents) { |
| 617 search_update_factory_.RevokeAll(); | 617 search_update_factory_.RevokeAll(); |
| 618 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 618 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 619 search_update_factory_.NewRunnableMethod( | 619 search_update_factory_.NewRunnableMethod( |
| 620 &CookiesView::UpdateSearchResults), kSearchFilterDelayMs); | 620 &CookiesView::UpdateSearchResults), kSearchFilterDelayMs); |
| 621 } | 621 } |
| 622 | 622 |
| 623 void CookiesView::HandleKeystroke(views::TextField* sender, UINT message, | 623 bool CookiesView::HandleKeystroke(views::TextField* sender, UINT message, |
| 624 TCHAR key, UINT repeat_count, UINT flags) { | 624 TCHAR key, UINT repeat_count, UINT flags) { |
| 625 switch (key) { | 625 switch (key) { |
| 626 case VK_ESCAPE: | 626 case VK_ESCAPE: |
| 627 ResetSearchQuery(); | 627 ResetSearchQuery(); |
| 628 break; | 628 break; |
| 629 case VK_RETURN: | 629 case VK_RETURN: |
| 630 search_update_factory_.RevokeAll(); | 630 search_update_factory_.RevokeAll(); |
| 631 UpdateSearchResults(); | 631 UpdateSearchResults(); |
| 632 break; | 632 break; |
| 633 } | 633 } |
| 634 return false; |
| 634 } | 635 } |
| 635 | 636 |
| 636 /////////////////////////////////////////////////////////////////////////////// | 637 /////////////////////////////////////////////////////////////////////////////// |
| 637 // CookiesView, views::DialogDelegate implementation: | 638 // CookiesView, views::DialogDelegate implementation: |
| 638 | 639 |
| 639 std::wstring CookiesView::GetWindowTitle() const { | 640 std::wstring CookiesView::GetWindowTitle() const { |
| 640 return l10n_util::GetString(IDS_COOKIES_WINDOW_TITLE); | 641 return l10n_util::GetString(IDS_COOKIES_WINDOW_TITLE); |
| 641 } | 642 } |
| 642 | 643 |
| 643 void CookiesView::WindowClosing() { | 644 void CookiesView::WindowClosing() { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 void CookiesView::ResetSearchQuery() { | 784 void CookiesView::ResetSearchQuery() { |
| 784 search_field_->SetText(EmptyWString()); | 785 search_field_->SetText(EmptyWString()); |
| 785 UpdateSearchResults(); | 786 UpdateSearchResults(); |
| 786 } | 787 } |
| 787 | 788 |
| 788 void CookiesView::UpdateForEmptyState() { | 789 void CookiesView::UpdateForEmptyState() { |
| 789 info_view_->ClearCookieDisplay(); | 790 info_view_->ClearCookieDisplay(); |
| 790 remove_button_->SetEnabled(false); | 791 remove_button_->SetEnabled(false); |
| 791 remove_all_button_->SetEnabled(false); | 792 remove_all_button_->SetEnabled(false); |
| 792 } | 793 } |
| OLD | NEW |