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/clear_server_data.h" | 5 #include "chrome/browser/views/clear_server_data.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 sync_service_->RemoveObserver(this); | 73 sync_service_->RemoveObserver(this); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void ClearServerDataView::Init() { | 77 void ClearServerDataView::Init() { |
78 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 78 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
79 gfx::Font title_font = | 79 gfx::Font title_font = |
80 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD); | 80 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD); |
81 | 81 |
82 flash_title_label_ = new views::Label( | 82 flash_title_label_ = new views::Label( |
83 l10n_util::GetString(IDS_CLEAR_DATA_ADOBE_FLASH_TITLE)); | 83 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_ADOBE_FLASH_TITLE))); |
84 flash_title_label_->SetFont(title_font); | 84 flash_title_label_->SetFont(title_font); |
85 | 85 |
86 flash_description_label_= new views::Label( | 86 flash_description_label_= new views::Label(UTF16ToWide( |
87 l10n_util::GetString(IDS_CLEAR_DATA_ADOBE_FLASH_DESCRIPTION)); | 87 l10n_util::GetStringUTF16(IDS_CLEAR_DATA_ADOBE_FLASH_DESCRIPTION))); |
88 flash_link_ = | 88 flash_link_ = new views::Link( |
89 new views::Link(l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS)); | 89 UTF16ToWide(l10n_util::GetStringUTF16(IDS_FLASH_STORAGE_SETTINGS))); |
90 flash_link_->SetController(this); | 90 flash_link_->SetController(this); |
91 | 91 |
92 chrome_sync_title_label_= new views::Label( | 92 chrome_sync_title_label_= new views::Label( |
93 l10n_util::GetString(IDS_CLEAR_DATA_CHROME_SYNC_TITLE)); | 93 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_CHROME_SYNC_TITLE))); |
94 chrome_sync_title_label_->SetFont(title_font); | 94 chrome_sync_title_label_->SetFont(title_font); |
95 | 95 |
96 chrome_sync_description_label_ = new views::Label( | 96 chrome_sync_description_label_ = new views::Label(UTF16ToWide( |
97 l10n_util::GetString(IDS_CLEAR_DATA_CLEAR_SERVER_DATA_DESCRIPTION)); | 97 l10n_util::GetStringUTF16(IDS_CLEAR_DATA_CLEAR_SERVER_DATA_DESCRIPTION))); |
98 | 98 |
99 clear_server_data_button_= new views::NativeButton( | 99 clear_server_data_button_= new views::NativeButton( |
100 this, l10n_util::GetString(IDS_CLEAR_DATA_CLEAR_BUTTON)); | 100 this, |
| 101 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_CLEAR_BUTTON))); |
101 | 102 |
102 dashboard_label_ = new views::Label( | 103 dashboard_label_ = new views::Label( |
103 l10n_util::GetString(IDS_CLEAR_DASHBOARD_DESCRIPTION)); | 104 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DASHBOARD_DESCRIPTION))); |
104 | 105 |
105 dashboard_link_ = new views::Link(); | 106 dashboard_link_ = new views::Link(); |
106 dashboard_link_->SetController(this); | 107 dashboard_link_->SetController(this); |
107 dashboard_link_->SetText( | 108 dashboard_link_->SetText(UTF16ToWide( |
108 l10n_util::GetString(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL)); | 109 l10n_util::GetStringUTF16(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL))); |
109 | 110 |
110 status_label_ = new views::Label( | 111 status_label_ = new views::Label( |
111 l10n_util::GetString(IDS_CLEAR_DATA_DELETING)); | 112 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_DELETING))); |
112 throbber_ = new views::Throbber(50, true); | 113 throbber_ = new views::Throbber(50, true); |
113 } | 114 } |
114 | 115 |
115 void ClearServerDataView::InitControlLayout() { | 116 void ClearServerDataView::InitControlLayout() { |
116 GridLayout* layout = CreatePanelGridLayout(this); | 117 GridLayout* layout = CreatePanelGridLayout(this); |
117 this->SetLayoutManager(layout); | 118 this->SetLayoutManager(layout); |
118 | 119 |
119 int centered_column_set_id = 0; | 120 int centered_column_set_id = 0; |
120 ColumnSet * column_set = layout->AddColumnSet(centered_column_set_id); | 121 ColumnSet * column_set = layout->AddColumnSet(centered_column_set_id); |
121 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 122 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 228 |
228 if (sender == clear_server_data_button_) { | 229 if (sender == clear_server_data_button_) { |
229 // Protect against the unlikely case where the server received a | 230 // Protect against the unlikely case where the server received a |
230 // message, and the syncer syncs and resets itself before the | 231 // message, and the syncer syncs and resets itself before the |
231 // user tries pressing the Clear button in this dialog again. | 232 // user tries pressing the Clear button in this dialog again. |
232 // TODO(raz) Confirm whether we have an issue here | 233 // TODO(raz) Confirm whether we have an issue here |
233 if (sync_service_->HasSyncSetupCompleted()) { | 234 if (sync_service_->HasSyncSetupCompleted()) { |
234 ConfirmMessageBoxDialog::Run( | 235 ConfirmMessageBoxDialog::Run( |
235 GetWindow()->GetNativeWindow(), | 236 GetWindow()->GetNativeWindow(), |
236 this, | 237 this, |
237 l10n_util::GetString(IDS_CONFIRM_CLEAR_DESCRIPTION), | 238 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_DESCRIPTION)), |
238 l10n_util::GetString(IDS_CONFIRM_CLEAR_TITLE)); | 239 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_TITLE))); |
239 } | 240 } |
240 } | 241 } |
241 | 242 |
242 UpdateControlEnabledState(); | 243 UpdateControlEnabledState(); |
243 } | 244 } |
244 | 245 |
245 void ClearServerDataView::LinkActivated(views::Link* source, | 246 void ClearServerDataView::LinkActivated(views::Link* source, |
246 int event_flags) { | 247 int event_flags) { |
247 Browser* browser = Browser::Create(profile_); | 248 Browser* browser = Browser::Create(profile_); |
248 if (source == flash_link_) { | 249 if (source == flash_link_) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 297 } |
297 | 298 |
298 switch (clear_state) { | 299 switch (clear_state) { |
299 case ProfileSyncService::CLEAR_NOT_STARTED: | 300 case ProfileSyncService::CLEAR_NOT_STARTED: |
300 // We can get here when we first start and after a failed clear (which | 301 // We can get here when we first start and after a failed clear (which |
301 // does not close the tab), do nothing. | 302 // does not close the tab), do nothing. |
302 break; | 303 break; |
303 case ProfileSyncService::CLEAR_CLEARING: | 304 case ProfileSyncService::CLEAR_CLEARING: |
304 // Clearing buttons on all tabs are disabled at this | 305 // Clearing buttons on all tabs are disabled at this |
305 // point, throbber is going | 306 // point, throbber is going |
306 status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_SENDING)); | 307 status_label_->SetText( |
| 308 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_SENDING))); |
307 status_label_->SetVisible(true); | 309 status_label_->SetVisible(true); |
308 delete_in_progress = true; | 310 delete_in_progress = true; |
309 break; | 311 break; |
310 case ProfileSyncService::CLEAR_FAILED: | 312 case ProfileSyncService::CLEAR_FAILED: |
311 // Show an error and reallow clearing | 313 // Show an error and reallow clearing |
312 clear_data_parent_window_->FailedClearingServerData(); | 314 clear_data_parent_window_->FailedClearingServerData(); |
313 status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_ERROR)); | 315 status_label_->SetText( |
| 316 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_ERROR))); |
314 status_label_->SetVisible(true); | 317 status_label_->SetVisible(true); |
315 delete_in_progress = false; | 318 delete_in_progress = false; |
316 break; | 319 break; |
317 case ProfileSyncService::CLEAR_SUCCEEDED: | 320 case ProfileSyncService::CLEAR_SUCCEEDED: |
318 // Close the dialog box, success! | 321 // Close the dialog box, success! |
319 status_label_->SetVisible(false); | 322 status_label_->SetVisible(false); |
320 delete_in_progress = false; | 323 delete_in_progress = false; |
321 clear_data_parent_window_->SucceededClearingServerData(); | 324 clear_data_parent_window_->SucceededClearingServerData(); |
322 break; | 325 break; |
323 } | 326 } |
(...skipping 11 matching lines...) Expand all Loading... |
335 } | 338 } |
336 | 339 |
337 void ClearServerDataView::UpdateClearButtonEnabledState( | 340 void ClearServerDataView::UpdateClearButtonEnabledState( |
338 bool delete_in_progress) { | 341 bool delete_in_progress) { |
339 this->clear_server_data_button_->SetEnabled( | 342 this->clear_server_data_button_->SetEnabled( |
340 sync_service_ != NULL && | 343 sync_service_ != NULL && |
341 sync_service_->HasSyncSetupCompleted() && | 344 sync_service_->HasSyncSetupCompleted() && |
342 !delete_in_progress && allow_clear_); | 345 !delete_in_progress && allow_clear_); |
343 } | 346 } |
344 | 347 |
OLD | NEW |