OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webui/options/chromeos/date_time_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/date_time_options_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/set_time_dialog.h" | 10 #include "chrome/browser/chromeos/set_time_dialog.h" |
| 11 #include "chrome/grit/generated_resources.h" |
11 #include "chromeos/dbus/dbus_thread_manager.h" | 12 #include "chromeos/dbus/dbus_thread_manager.h" |
12 #include "chromeos/dbus/system_clock_client.h" | 13 #include "chromeos/dbus/system_clock_client.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_ui.h" | 15 #include "content/public/browser/web_ui.h" |
15 #include "grit/generated_resources.h" | |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 namespace options { | 19 namespace options { |
20 | 20 |
21 DateTimeOptionsHandler::DateTimeOptionsHandler() | 21 DateTimeOptionsHandler::DateTimeOptionsHandler() |
22 : can_set_time_(false), page_initialized_(false) { | 22 : can_set_time_(false), page_initialized_(false) { |
23 } | 23 } |
24 | 24 |
25 DateTimeOptionsHandler::~DateTimeOptionsHandler() { | 25 DateTimeOptionsHandler::~DateTimeOptionsHandler() { |
26 DBusThreadManager::Get()->GetSystemClockClient()->RemoveObserver(this); | 26 DBusThreadManager::Get()->GetSystemClockClient()->RemoveObserver(this); |
27 } | 27 } |
28 | 28 |
29 void DateTimeOptionsHandler::GetLocalizedValues( | 29 void DateTimeOptionsHandler::GetLocalizedValues( |
30 base::DictionaryValue* localized_strings) { | 30 base::DictionaryValue* localized_strings) { |
31 DCHECK(localized_strings); | 31 DCHECK(localized_strings); |
32 | 32 |
33 localized_strings->SetString( | 33 localized_strings->SetString( |
34 "setTimeButton", | 34 "setTimeButton", |
35 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SET_TIME_BUTTON)); | 35 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SET_TIME_BUTTON)); |
36 localized_strings->SetString( | 36 localized_strings->SetString( |
37 "timeSyncedExplanation", | 37 "timeSyncedExplanation", |
38 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_TIME_SYNCED_EXPLANATION)); | 38 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_TIME_SYNCED_EXPLANATION)); |
39 }; | 39 } |
40 | 40 |
41 void DateTimeOptionsHandler::InitializeHandler() { | 41 void DateTimeOptionsHandler::InitializeHandler() { |
42 SystemClockClient* system_clock_client = | 42 SystemClockClient* system_clock_client = |
43 DBusThreadManager::Get()->GetSystemClockClient(); | 43 DBusThreadManager::Get()->GetSystemClockClient(); |
44 system_clock_client->AddObserver(this); | 44 system_clock_client->AddObserver(this); |
45 | 45 |
46 can_set_time_ = system_clock_client->CanSetTime(); | 46 can_set_time_ = system_clock_client->CanSetTime(); |
47 SystemClockCanSetTimeChanged(can_set_time_); | 47 SystemClockCanSetTimeChanged(can_set_time_); |
48 } | 48 } |
49 | 49 |
(...skipping 21 matching lines...) Expand all Loading... |
71 void DateTimeOptionsHandler::HandleShowSetTime(const base::ListValue* args) { | 71 void DateTimeOptionsHandler::HandleShowSetTime(const base::ListValue* args) { |
72 // Make sure the clock status hasn't changed since the button was clicked. | 72 // Make sure the clock status hasn't changed since the button was clicked. |
73 if (can_set_time_) { | 73 if (can_set_time_) { |
74 SetTimeDialog::ShowDialog( | 74 SetTimeDialog::ShowDialog( |
75 web_ui()->GetWebContents()->GetTopLevelNativeWindow()); | 75 web_ui()->GetWebContents()->GetTopLevelNativeWindow()); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 } // namespace options | 79 } // namespace options |
80 } // namespace chromeos | 80 } // namespace chromeos |
OLD | NEW |