| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/local_storage_info_view.h" | 5 #include "chrome/browser/views/local_storage_info_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 void LocalStorageInfoView::EnableLocalStorageDisplay(bool enabled) { | 47 void LocalStorageInfoView::EnableLocalStorageDisplay(bool enabled) { |
| 48 origin_value_field_->SetEnabled(enabled); | 48 origin_value_field_->SetEnabled(enabled); |
| 49 size_value_field_->SetEnabled(enabled); | 49 size_value_field_->SetEnabled(enabled); |
| 50 last_modified_value_field_->SetEnabled(enabled); | 50 last_modified_value_field_->SetEnabled(enabled); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void LocalStorageInfoView::ClearLocalStorageDisplay() { | 53 void LocalStorageInfoView::ClearLocalStorageDisplay() { |
| 54 std::wstring no_cookie_string = | 54 std::wstring no_cookie_string = |
| 55 l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED); | 55 UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED)); |
| 56 origin_value_field_->SetText(no_cookie_string); | 56 origin_value_field_->SetText(no_cookie_string); |
| 57 size_value_field_->SetText(no_cookie_string); | 57 size_value_field_->SetText(no_cookie_string); |
| 58 last_modified_value_field_->SetText(no_cookie_string); | 58 last_modified_value_field_->SetText(no_cookie_string); |
| 59 EnableLocalStorageDisplay(false); | 59 EnableLocalStorageDisplay(false); |
| 60 } | 60 } |
| 61 | 61 |
| 62 /////////////////////////////////////////////////////////////////////////////// | 62 /////////////////////////////////////////////////////////////////////////////// |
| 63 // LocalStorageInfoView, views::View overrides: | 63 // LocalStorageInfoView, views::View overrides: |
| 64 | 64 |
| 65 void LocalStorageInfoView::ViewHierarchyChanged(bool is_add, | 65 void LocalStorageInfoView::ViewHierarchyChanged(bool is_add, |
| 66 views::View* parent, | 66 views::View* parent, |
| 67 views::View* child) { | 67 views::View* child) { |
| 68 if (is_add && child == this) | 68 if (is_add && child == this) |
| 69 Init(); | 69 Init(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
| 73 // LocalStorageInfoView, private: | 73 // LocalStorageInfoView, private: |
| 74 | 74 |
| 75 void LocalStorageInfoView::Init() { | 75 void LocalStorageInfoView::Init() { |
| 76 SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW); | 76 SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW); |
| 77 views::Border* border = views::Border::CreateSolidBorder( | 77 views::Border* border = views::Border::CreateSolidBorder( |
| 78 kLocalStorageInfoViewBorderSize, border_color); | 78 kLocalStorageInfoViewBorderSize, border_color); |
| 79 set_border(border); | 79 set_border(border); |
| 80 | 80 |
| 81 views::Label* origin_label = new views::Label( | 81 views::Label* origin_label = new views::Label(UTF16ToWide( |
| 82 l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL)); | 82 l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL))); |
| 83 origin_value_field_ = new views::Textfield; | 83 origin_value_field_ = new views::Textfield; |
| 84 views::Label* size_label = new views::Label( | 84 views::Label* size_label = new views::Label(UTF16ToWide( |
| 85 l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)); | 85 l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL))); |
| 86 size_value_field_ = new views::Textfield; | 86 size_value_field_ = new views::Textfield; |
| 87 views::Label* last_modified_label = new views::Label( | 87 views::Label* last_modified_label = new views::Label(UTF16ToWide( |
| 88 l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)); | 88 l10n_util::GetStringUTF16( |
| 89 IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL))); |
| 89 last_modified_value_field_ = new views::Textfield; | 90 last_modified_value_field_ = new views::Textfield; |
| 90 | 91 |
| 91 using views::GridLayout; | 92 using views::GridLayout; |
| 92 | 93 |
| 93 GridLayout* layout = new GridLayout(this); | 94 GridLayout* layout = new GridLayout(this); |
| 94 layout->SetInsets(kLocalStorageInfoViewInsetSize, | 95 layout->SetInsets(kLocalStorageInfoViewInsetSize, |
| 95 kLocalStorageInfoViewInsetSize, | 96 kLocalStorageInfoViewInsetSize, |
| 96 kLocalStorageInfoViewInsetSize, | 97 kLocalStorageInfoViewInsetSize, |
| 97 kLocalStorageInfoViewInsetSize); | 98 kLocalStorageInfoViewInsetSize); |
| 98 SetLayoutManager(layout); | 99 SetLayoutManager(layout); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 124 origin_value_field_->RemoveBorder(); | 125 origin_value_field_->RemoveBorder(); |
| 125 origin_value_field_->SetBackgroundColor(text_area_background); | 126 origin_value_field_->SetBackgroundColor(text_area_background); |
| 126 size_value_field_->SetReadOnly(true); | 127 size_value_field_->SetReadOnly(true); |
| 127 size_value_field_->RemoveBorder(); | 128 size_value_field_->RemoveBorder(); |
| 128 size_value_field_->SetBackgroundColor(text_area_background); | 129 size_value_field_->SetBackgroundColor(text_area_background); |
| 129 last_modified_value_field_->SetReadOnly(true); | 130 last_modified_value_field_->SetReadOnly(true); |
| 130 last_modified_value_field_->RemoveBorder(); | 131 last_modified_value_field_->RemoveBorder(); |
| 131 last_modified_value_field_->SetBackgroundColor(text_area_background); | 132 last_modified_value_field_->SetBackgroundColor(text_area_background); |
| 132 } | 133 } |
| 133 | 134 |
| OLD | NEW |