diff options
author | chocobo@google.com <chocobo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 21:08:29 +0000 |
---|---|---|
committer | chocobo@google.com <chocobo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 21:08:29 +0000 |
commit | fecc1520c83dc037865ba49846f764ce056d4016 (patch) | |
tree | 54be637f39785fda3046ca0a276be1ceba2c9999 /chrome | |
parent | 40c2a7869363f42ab82b48bd5d4cb1a776cd2809 (diff) | |
download | chromium_src-fecc1520c83dc037865ba49846f764ce056d4016.zip chromium_src-fecc1520c83dc037865ba49846f764ce056d4016.tar.gz chromium_src-fecc1520c83dc037865ba49846f764ce056d4016.tar.bz2 |
Add UI for changing timezones.
BUG=24876
TEST=none
Review URL: http://codereview.chromium.org/267113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/clock_menu_button.cc | 74 | ||||
-rw-r--r-- | chrome/browser/chromeos/clock_menu_button.h | 29 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.cc | 63 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.h | 55 | ||||
-rw-r--r-- | chrome/browser/chromeos/settings_contents_view.cc | 391 | ||||
-rwxr-xr-x | chrome/browser/chromeos/status_area_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/touchpad.cc | 72 | ||||
-rw-r--r-- | chrome/browser/chromeos/touchpad.h | 47 | ||||
-rw-r--r-- | chrome/browser/options_util.cc | 1 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 6 | ||||
-rw-r--r-- | chrome/browser/profile.h | 4 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 10 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
15 files changed, 495 insertions, 272 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index fe93f2e..f1bb694 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -5657,6 +5657,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <!-- Chrome OS Strings --> <if expr="pp_ifdef('chromeos') or pp_ifdef('toolkit_views')"> + <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME"> + Date and Time + </message> <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_NETWORK"> Network </message> @@ -5666,6 +5669,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_PASSWORD"> Network Password </message> + <message name="IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION" desc="In the settings tab, the text next to the timezone combobox."> + Timezone: + </message> <message name="IDS_OPTIONS_SETTINGS_TAP_TO_CLICK_ENABLED_DESCRIPTION" desc="In the settings tab, the text next to the checkbox that enables tap-to-click."> Enable tap-to-click </message> @@ -5681,6 +5687,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_STATUSBAR_NO_NETWORKS_MESSAGE" desc="No networks are available"> No networks are available </message> + <message name="IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG" desc="The menu item in the clock menu button for opening the options dialog"> + Open date and time options... + </message> <message name="IDS_STATUSBAR_CLOCK_SHORT_TIME_AM" desc="In the clock menu button, this shows the AM time in a short format."> <ph name="HOUR">$1<ex>2</ex></ph>:<ph name="MIUTE">$2<ex>30</ex></ph>a </message> diff --git a/chrome/browser/chromeos/clock_menu_button.cc b/chrome/browser/chromeos/clock_menu_button.cc index 99da88a..247b5fe 100644 --- a/chrome/browser/chromeos/clock_menu_button.cc +++ b/chrome/browser/chromeos/clock_menu_button.cc @@ -11,15 +11,21 @@ #include "base/i18n/time_formatting.h" #include "base/string_util.h" #include "base/time.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/profile.h" +#include "chrome/common/notification_service.h" +#include "chrome/common/pref_names.h" #include "grit/generated_resources.h" +#include "unicode/calendar.h" // Amount of slop to add into the timer to make sure we're into the next minute // when the timer goes off. const int kTimerSlopSeconds = 1; -ClockMenuButton::ClockMenuButton() +ClockMenuButton::ClockMenuButton(Browser* browser) : MenuButton(NULL, std::wstring(), this, false), - clock_menu_(this) { + clock_menu_(this), + browser_(browser) { SetFont(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD)); SetEnabledColor(SK_ColorWHITE); @@ -29,10 +35,24 @@ ClockMenuButton::ClockMenuButton() SetText(l10n_util::GetStringF(IDS_STATUSBAR_CLOCK_SHORT_TIME_AM, zero, zero)); SetText(l10n_util::GetStringF(IDS_STATUSBAR_CLOCK_SHORT_TIME_PM, zero, zero)); set_alignment(TextButton::ALIGN_RIGHT); - UpdateText(); + UpdateTextAndSetNextTimer(); + // Init member prefs so we can update the controls if prefs change. + timezone_.Init(prefs::kTimeZone, browser_->profile()->GetPrefs(), this); +} + +void ClockMenuButton::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + if (type == NotificationType::PREF_CHANGED) { + const std::wstring* pref_name = Details<std::wstring>(details).ptr(); + if (!pref_name || *pref_name == prefs::kTimeZone) + UpdateText(); + } } -void ClockMenuButton::SetNextTimer() { +void ClockMenuButton::UpdateTextAndSetNextTimer() { + UpdateText(); + // Try to set the timer to go off at the next change of the minute. We don't // want to have the timer go off more than necessary since that will cause // the CPU to wake up and consume power. @@ -51,44 +71,64 @@ void ClockMenuButton::SetNextTimer() { seconds_left += kTimerSlopSeconds; timer_.Start(base::TimeDelta::FromSeconds(seconds_left), this, - &ClockMenuButton::UpdateText); + &ClockMenuButton::UpdateTextAndSetNextTimer); } void ClockMenuButton::UpdateText() { - base::Time::Exploded now; - base::Time::Now().LocalExplode(&now); - int hour = now.hour % 12; + // Use icu::Calendar because the correct timezone is set on icu::TimeZone's + // default timezone. + UErrorCode error = U_ZERO_ERROR; + scoped_ptr<icu::Calendar> cal(icu::Calendar::createInstance(error)); + if (!cal.get()) + return; + + int hour = cal->get(UCAL_HOUR, error); + int minute = cal->get(UCAL_MINUTE, error); + int ampm = cal->get(UCAL_AM_PM, error); + if (hour == 0) hour = 12; - std::wstring hour_str = IntToWString(hour); - std::wstring min_str = IntToWString(now.minute); + std::wstring min_str = IntToWString(minute); // Append a "0" before the minute if it's only a single digit. - if (now.minute < 10) + if (minute < 10) min_str = IntToWString(0) + min_str; - int msg = now.hour < 12 ? IDS_STATUSBAR_CLOCK_SHORT_TIME_AM : - IDS_STATUSBAR_CLOCK_SHORT_TIME_PM; + int msg = (ampm == UCAL_AM) ? IDS_STATUSBAR_CLOCK_SHORT_TIME_AM : + IDS_STATUSBAR_CLOCK_SHORT_TIME_PM; std::wstring time_string = l10n_util::GetStringF(msg, hour_str, min_str); SetText(time_string); SchedulePaint(); - SetNextTimer(); } //////////////////////////////////////////////////////////////////////////////// // ClockMenuButton, views::Menu2Model implementation: int ClockMenuButton::GetItemCount() const { - return 1; + return 3; } views::Menu2Model::ItemType ClockMenuButton::GetTypeAt(int index) const { - return views::Menu2Model::TYPE_COMMAND; + // There's a separator between the current date and the menu item to open + // the options menu. + return index == 1 ? views::Menu2Model::TYPE_SEPARATOR: + views::Menu2Model::TYPE_COMMAND; } string16 ClockMenuButton::GetLabelAt(int index) const { - return WideToUTF16(base::TimeFormatFriendlyDate(base::Time::Now())); + if (index == 0) + return WideToUTF16(base::TimeFormatFriendlyDate(base::Time::Now())); + return l10n_util::GetStringUTF16(IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG); +} + +bool ClockMenuButton::IsEnabledAt(int index) const { + // The 1st item is the current date, which is disabled. + return index != 0; +} + +void ClockMenuButton::ActivatedAt(int index) { + browser_->ShowControlPanel(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/clock_menu_button.h b/chrome/browser/chromeos/clock_menu_button.h index 54d0389..e268cd2 100644 --- a/chrome/browser/chromeos/clock_menu_button.h +++ b/chrome/browser/chromeos/clock_menu_button.h @@ -6,17 +6,22 @@ #define CHROME_BROWSER_CHROMEOS_CLOCK_MENU_BUTTON_H_ #include "base/timer.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/pref_member.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu_2.h" #include "views/controls/menu/view_menu_delegate.h" +class Browser; + // The clock menu button in the status area. // This button shows the current time. class ClockMenuButton : public views::MenuButton, public views::ViewMenuDelegate, - public views::Menu2Model { + public views::Menu2Model, + public NotificationObserver { public: - ClockMenuButton(); + explicit ClockMenuButton(Browser* browser); virtual ~ClockMenuButton() {} // views::Menu2Model implementation. @@ -31,27 +36,37 @@ class ClockMenuButton : public views::MenuButton, virtual bool IsItemCheckedAt(int index) const { return false; } virtual int GetGroupIdAt(int index) const { return 0; } virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } - virtual bool IsEnabledAt(int index) const { return false; } + virtual bool IsEnabledAt(int index) const; virtual Menu2Model* GetSubmenuModelAt(int index) const { return NULL; } virtual void HighlightChangedTo(int index) {} - virtual void ActivatedAt(int index) {} + virtual void ActivatedAt(int index); virtual void MenuWillShow() {} + // Overridden from NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + private: // views::ViewMenuDelegate implementation. virtual void RunMenu(views::View* source, const gfx::Point& pt); - // Schedules the timer to fire at the next minute interval. - void SetNextTimer(); + // Updates text and schedules the timer to fire at the next minute interval. + void UpdateTextAndSetNextTimer(); - // Updates the time on the menu button and sets the next timer. + // Updates the time on the menu button. void UpdateText(); base::OneShotTimer<ClockMenuButton> timer_; + StringPrefMember timezone_; + // The clock menu. views::Menu2 clock_menu_; + // The browser window that owns us. + Browser* browser_; + DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); }; diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc new file mode 100644 index 0000000..a586ade --- /dev/null +++ b/chrome/browser/chromeos/preferences.cc @@ -0,0 +1,63 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/preferences.h" + +#include "base/string_util.h" +#include "chrome/browser/chromeos/touchpad.h" +#include "chrome/common/notification_service.h" +#include "chrome/common/pref_member.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" +#include "unicode/timezone.h" + +namespace chromeos { + +// static +void Preferences::RegisterUserPrefs(PrefService* prefs) { + prefs->RegisterStringPref(prefs::kTimeZone, L"US/Pacific"); + prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, false); + prefs->RegisterBooleanPref(prefs::kVertEdgeScrollEnabled, false); + prefs->RegisterIntegerPref(prefs::kTouchpadSpeedFactor, 5); + prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, 5); +} + +void Preferences::Init(PrefService* prefs) { + timezone_.Init(prefs::kTimeZone, prefs, this); + tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); + vert_edge_scroll_enabled_.Init(prefs::kVertEdgeScrollEnabled, prefs, this); + speed_factor_.Init(prefs::kTouchpadSpeedFactor, prefs, this); + sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); + + // Initialize touchpad settings to what's saved in user preferences. + NotifyPrefChanged(NULL); +} + +void Preferences::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + if (type == NotificationType::PREF_CHANGED) + NotifyPrefChanged(Details<std::wstring>(details).ptr()); +} + +void Preferences::NotifyPrefChanged(const std::wstring* pref_name) { + if (!pref_name || *pref_name == prefs::kTimeZone) + SetTimeZone(timezone_.GetValue()); + if (!pref_name || *pref_name == prefs::kTapToClickEnabled) + Touchpad::SetTapToClick(tap_to_click_enabled_.GetValue()); + if (!pref_name || *pref_name == prefs::kVertEdgeScrollEnabled) + Touchpad::SetVertEdgeScroll(vert_edge_scroll_enabled_.GetValue()); + if (!pref_name || *pref_name == prefs::kTouchpadSpeedFactor) + Touchpad::SetSpeedFactor(speed_factor_.GetValue()); + if (!pref_name || *pref_name == prefs::kTouchpadSensitivity) + Touchpad::SetSensitivity(sensitivity_.GetValue()); +} + +void Preferences::SetTimeZone(const std::wstring& id) { + icu::TimeZone* timezone = icu::TimeZone::createTimeZone( + icu::UnicodeString::fromUTF8(WideToASCII(id))); + icu::TimeZone::adoptDefault(timezone); +} + +} // namespace chromeos diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h new file mode 100644 index 0000000..b4a01be --- /dev/null +++ b/chrome/browser/chromeos/preferences.h @@ -0,0 +1,55 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ +#define CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ + +#include "chrome/common/notification_observer.h" +#include "chrome/common/pref_member.h" + +class PrefService; + +namespace chromeos { + +// The Preferences class handles Chrome OS preferences. When the class +// is first initialized, it will initialize the OS settings to what's stored in +// the preferences. These include timezones, touchpad settings, etc. +// When the preferences change, we change the settings to reflect the new value. +class Preferences : public NotificationObserver { + public: + Preferences() {} + virtual ~Preferences() {} + + // This method will register the prefs associated with Chrome OS settings. + static void RegisterUserPrefs(PrefService* prefs); + + // This method will initialize Chrome OS settings to values in user prefs. + void Init(PrefService* prefs); + + // Overridden from NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + protected: + // This will set the OS settings when the preference changes. + // If this method is called with NULL, it will set all OS settings to what's + // stored in the preferences. + virtual void NotifyPrefChanged(const std::wstring* pref_name); + + private: + void SetTimeZone(const std::wstring& id); + + StringPrefMember timezone_; + BooleanPrefMember tap_to_click_enabled_; + BooleanPrefMember vert_edge_scroll_enabled_; + IntegerPrefMember speed_factor_; + IntegerPrefMember sensitivity_; + + DISALLOW_COPY_AND_ASSIGN(Preferences); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ diff --git a/chrome/browser/chromeos/settings_contents_view.cc b/chrome/browser/chromeos/settings_contents_view.cc index 86a229d..e2681a6 100644 --- a/chrome/browser/chromeos/settings_contents_view.cc +++ b/chrome/browser/chromeos/settings_contents_view.cc @@ -12,6 +12,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/basictypes.h" +#include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/chromeos/cros_network_library.h" #include "chrome/browser/chromeos/password_dialog_view.h" @@ -19,6 +20,8 @@ #include "chrome/common/pref_names.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "unicode/strenum.h" +#include "unicode/timezone.h" #include "views/background.h" #include "views/controls/button/checkbox.h" #include "views/controls/combobox/combobox.h" @@ -33,60 +36,223 @@ using views::ColumnSet; namespace { //////////////////////////////////////////////////////////////////////////////// -// WifiNetworkComboModel +// SettingsContentsSection -// The Combobox model for the list of wifi networks -class WifiNetworkComboModel : public ComboboxModel { +// Base section class settings +class SettingsContentsSection : public OptionsPageView { public: - WifiNetworkComboModel(); + explicit SettingsContentsSection(Profile* profile, int title_msg_id); + virtual ~SettingsContentsSection() {} - virtual int GetItemCount(); - virtual std::wstring GetItemAt(int index); + protected: + // OptionsPageView overrides: + virtual void InitControlLayout(); + virtual void InitContents(GridLayout* layout) = 0; - bool HasWifiNetworks(); - const WifiNetwork& GetWifiNetworkAt(int index); + int single_column_view_set_id() const { return single_column_view_set_id_; } + int double_column_view_set_id() const { return double_column_view_set_id_; } private: - WifiNetworkVector wifi_networks_; + // The message id for the title of this section. + int title_msg_id_; - DISALLOW_COPY_AND_ASSIGN(WifiNetworkComboModel); + int single_column_view_set_id_; + int double_column_view_set_id_; + + DISALLOW_COPY_AND_ASSIGN(SettingsContentsSection); }; -WifiNetworkComboModel::WifiNetworkComboModel() { - wifi_networks_ = CrosNetworkLibrary::Get()->wifi_networks(); +SettingsContentsSection::SettingsContentsSection(Profile* profile, + int title_msg_id) + : OptionsPageView(profile), + title_msg_id_(title_msg_id), + single_column_view_set_id_(0), + double_column_view_set_id_(1) { } -int WifiNetworkComboModel::GetItemCount() { - // Item count is always 1 more than number of networks. - // If there are no networks, then we show a message stating that. - // If there are networks, the first item is empty. - return static_cast<int>(wifi_networks_.size()) + 1; +void SettingsContentsSection::InitControlLayout() { + GridLayout* layout = new GridLayout(this); + SetLayoutManager(layout); + + int single_column_layout_id = 0; + ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); + column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, + GridLayout::USE_PREF, 0, 0); + int inset_column_layout_id = 1; + column_set = layout->AddColumnSet(inset_column_layout_id); + column_set->AddPaddingColumn(0, kUnrelatedControlHorizontalSpacing); + column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 1, + GridLayout::USE_PREF, 0, 0); + + layout->StartRow(0, single_column_layout_id); + views::Label* title_label = new views::Label( + l10n_util::GetString(title_msg_id_)); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + gfx::Font title_font = + rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD); + title_label->SetFont(title_font); + layout->AddView(title_label); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + layout->StartRow(0, inset_column_layout_id); + + views::View* contents = new views::View; + GridLayout* child_layout = new GridLayout(contents); + contents->SetLayoutManager(child_layout); + + column_set = child_layout->AddColumnSet(single_column_view_set_id_); + column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, + GridLayout::USE_PREF, 0, 0); + + column_set = child_layout->AddColumnSet(double_column_view_set_id_); + column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, + GridLayout::USE_PREF, 0, 0); + column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); + column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, + GridLayout::USE_PREF, 0, 0); + + InitContents(child_layout); + layout->AddView(contents); } -std::wstring WifiNetworkComboModel::GetItemAt(int index) { - if (index == 0) { - return wifi_networks_.empty() ? - l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE) : - ASCIIToWide(""); - } - // If index is greater than one, we get the corresponding network, which is - // in the wifi_networks_ list in [index-1] position. - return ASCIIToWide(wifi_networks_[index-1].ssid); +//////////////////////////////////////////////////////////////////////////////// +// DateTimeSection + +// Date/Time section for datetime settings +class DateTimeSection : public SettingsContentsSection, + public views::Combobox::Listener { + public: + explicit DateTimeSection(Profile* profile); + virtual ~DateTimeSection() {} + + // Overridden from views::Combobox::Listener: + virtual void ItemChanged(views::Combobox* sender, + int prev_index, + int new_index); + + protected: + // SettingsContentsSection overrides: + virtual void InitContents(GridLayout* layout); + virtual void NotifyPrefChanged(const std::wstring* pref_name); + + private: + // The combobox model for the list of timezones. + class TimezoneComboboxModel : public ComboboxModel { + public: + TimezoneComboboxModel() { + timezones_.push_back(icu::TimeZone::createTimeZone( + icu::UnicodeString::fromUTF8("US/Pacific"))); + timezones_.push_back(icu::TimeZone::createTimeZone( + icu::UnicodeString::fromUTF8("US/Mountain"))); + timezones_.push_back(icu::TimeZone::createTimeZone( + icu::UnicodeString::fromUTF8("US/Central"))); + timezones_.push_back(icu::TimeZone::createTimeZone( + icu::UnicodeString::fromUTF8("US/Eastern"))); + // For now, add all the GMT timezones. + // We may eventually want to use icu::TimeZone::createEnumeration() + // to list all the timezones and pick the ones we want to show. + for (int i = 11; i >= -12; i--) { + // For positive i's, add the extra '+'. + std::string str = StringPrintf(i > 0 ? "Etc/GMT+%d" : "Etc/GMT%d", i); + icu::TimeZone* timezone = icu::TimeZone::createTimeZone( + icu::UnicodeString::fromUTF8(str.c_str())); + timezones_.push_back(timezone); + } + } + + virtual ~TimezoneComboboxModel() { + STLDeleteElements(&timezones_); + } + + virtual int GetItemCount() { + return static_cast<int>(timezones_.size()); + } + + virtual std::wstring GetItemAt(int index) { + icu::UnicodeString name; + timezones_[index]->getDisplayName(name); + std::wstring output; + UTF16ToWide(name.getBuffer(), name.length(), &output); + return output; + } + + virtual std::wstring GetTimeZoneIDAt(int index) { + icu::UnicodeString id; + timezones_[index]->getID(id); + std::wstring output; + UTF16ToWide(id.getBuffer(), id.length(), &output); + return output; + } + + private: + std::vector<icu::TimeZone*> timezones_; + + DISALLOW_COPY_AND_ASSIGN(TimezoneComboboxModel); + }; + + // Selects the timezone. + void SelectTimeZone(const std::wstring& id); + + // TimeZone combobox model. + views::Combobox* timezone_combobox_; + + // Controls for this section: + TimezoneComboboxModel timezone_combobox_model_; + + // Preferences for this section: + StringPrefMember timezone_; + + DISALLOW_COPY_AND_ASSIGN(DateTimeSection); +}; + +DateTimeSection::DateTimeSection(Profile* profile) + : SettingsContentsSection(profile, + IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME), + timezone_combobox_(NULL) { +} + +void DateTimeSection::ItemChanged(views::Combobox* sender, + int prev_index, + int new_index) { + if (new_index == prev_index) + return; + timezone_.SetValue(timezone_combobox_model_.GetTimeZoneIDAt(new_index)); +} + +void DateTimeSection::InitContents(GridLayout* layout) { + timezone_combobox_ = new views::Combobox(&timezone_combobox_model_); + timezone_combobox_->set_listener(this); + + layout->StartRow(0, double_column_view_set_id()); + layout->AddView(new views::Label( + l10n_util::GetString(IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION))); + layout->AddView(timezone_combobox_); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + + // Init member prefs so we can update the controls if prefs change. + timezone_.Init(prefs::kTimeZone, profile()->GetPrefs(), this); } -bool WifiNetworkComboModel::HasWifiNetworks() { - return !wifi_networks_.empty(); +void DateTimeSection::NotifyPrefChanged(const std::wstring* pref_name) { + if (!pref_name || *pref_name == prefs::kTimeZone) { + std::wstring timezone = timezone_.GetValue(); + SelectTimeZone(timezone); + } } -const WifiNetwork& WifiNetworkComboModel::GetWifiNetworkAt(int index) { - return wifi_networks_[index-1]; +void DateTimeSection::SelectTimeZone(const std::wstring& id) { + for (int i = 0; i < timezone_combobox_model_.GetItemCount(); i++) { + if (timezone_combobox_model_.GetTimeZoneIDAt(i) == id) { + timezone_combobox_->SetSelectedItem(i); + return; + } + } } //////////////////////////////////////////////////////////////////////////////// // NetworkSection // Network section for wifi settings -class NetworkSection : public OptionsPageView, +class NetworkSection : public SettingsContentsSection, public views::Combobox::Listener, public PasswordDialogDelegate, public CrosNetworkLibrary::Observer { @@ -108,18 +274,52 @@ class NetworkSection : public OptionsPageView, virtual void NetworkChanged(CrosNetworkLibrary* obj); protected: - // OptionsPageView overrides: - virtual void InitControlLayout(); - virtual void InitContents(); + // SettingsContentsSection overrides: + virtual void InitContents(GridLayout* layout); private: + // The Combobox model for the list of wifi networks + class WifiNetworkComboModel : public ComboboxModel { + public: + WifiNetworkComboModel() { + wifi_networks_ = CrosNetworkLibrary::Get()->wifi_networks(); + } + + virtual int GetItemCount() { + // Item count is always 1 more than number of networks. + // If there are no networks, then we show a message stating that. + // If there are networks, the first item is empty. + return static_cast<int>(wifi_networks_.size()) + 1; + } + + virtual std::wstring GetItemAt(int index) { + if (index == 0) { + return wifi_networks_.empty() ? + l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE) : + std::wstring(); + } + // If index is greater than one, we get the corresponding network, + // which is in the wifi_networks_ list in [index-1] position. + return ASCIIToWide(wifi_networks_[index-1].ssid); + } + + virtual bool HasWifiNetworks() { + return !wifi_networks_.empty(); + } + + virtual const WifiNetwork& GetWifiNetworkAt(int index) { + return wifi_networks_[index-1]; + } + + private: + WifiNetworkVector wifi_networks_; + + DISALLOW_COPY_AND_ASSIGN(WifiNetworkComboModel); + }; // This method will change the combobox selection to the passed in wifi ssid. void SelectWifi(const std::string& wifi_ssid); - // The View that contains the contents of the section. - views::View* contents_; - // Controls for this section: views::Combobox* wifi_ssid_combobox_; @@ -135,12 +335,9 @@ class NetworkSection : public OptionsPageView, DISALLOW_COPY_AND_ASSIGN(NetworkSection); }; -//////////////////////////////////////////////////////////////////////////////// -// NetworkSection - NetworkSection::NetworkSection(Profile* profile) - : OptionsPageView(profile), - contents_(NULL), + : SettingsContentsSection(profile, + IDS_OPTIONS_SETTINGS_SECTION_TITLE_NETWORK), wifi_ssid_combobox_(NULL), last_selected_wifi_ssid_index_(0) { CrosNetworkLibrary::Get()->AddObserver(this); @@ -198,49 +395,12 @@ void NetworkSection::NetworkChanged(CrosNetworkLibrary* obj) { SelectWifi(obj->wifi_ssid()); } -void NetworkSection::InitControlLayout() { - GridLayout* layout = new GridLayout(this); - SetLayoutManager(layout); - - int single_column_layout_id = 0; - ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); - column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, - GridLayout::USE_PREF, 0, 0); - int inset_column_layout_id = 1; - column_set = layout->AddColumnSet(inset_column_layout_id); - column_set->AddPaddingColumn(0, kUnrelatedControlHorizontalSpacing); - column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 1, - GridLayout::USE_PREF, 0, 0); - - layout->StartRow(0, single_column_layout_id); - views::Label* title_label = new views::Label( - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_NETWORK)); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::Font title_font = - rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD); - title_label->SetFont(title_font); - layout->AddView(title_label); - layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(0, inset_column_layout_id); - InitContents(); - layout->AddView(contents_); -} - -void NetworkSection::InitContents() { - contents_ = new views::View; - GridLayout* layout = new GridLayout(contents_); - contents_->SetLayoutManager(layout); - +void NetworkSection::InitContents(GridLayout* layout) { wifi_ssid_combobox_ = new views::Combobox(&wifi_ssid_model_); wifi_ssid_combobox_->SetSelectedItem(last_selected_wifi_ssid_index_); wifi_ssid_combobox_->set_listener(this); - int single_column_view_set_id = 0; - ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); - column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, - GridLayout::USE_PREF, 0, 0); - - layout->StartRow(0, single_column_view_set_id); + layout->StartRow(0, single_column_view_set_id()); layout->AddView(wifi_ssid_combobox_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); @@ -270,7 +430,7 @@ void NetworkSection::SelectWifi(const std::string& wifi_ssid) { //////////////////////////////////////////////////////////////////////////////// // TouchpadSection -class TouchpadSection : public OptionsPageView, +class TouchpadSection : public SettingsContentsSection, public views::ButtonListener, public views::SliderListener { public: @@ -284,9 +444,8 @@ class TouchpadSection : public OptionsPageView, virtual void SliderValueChanged(views::Slider* sender); protected: - // OptionsPageView overrides: - virtual void InitControlLayout(); - virtual void InitContents(); + // SettingsContentsSection overrides: + virtual void InitContents(GridLayout* layout); virtual void NotifyPrefChanged(const std::wstring* pref_name); private: @@ -309,8 +468,8 @@ class TouchpadSection : public OptionsPageView, }; TouchpadSection::TouchpadSection(Profile* profile) - : OptionsPageView(profile), - contents_(NULL), + : SettingsContentsSection(profile, + IDS_OPTIONS_SETTINGS_SECTION_TITLE_TOUCHPAD), enable_tap_to_click_checkbox_(NULL), enable_vert_edge_scroll_checkbox_(NULL), speed_factor_slider_(NULL), @@ -350,39 +509,7 @@ void TouchpadSection::SliderValueChanged(views::Slider* sender) { } } -void TouchpadSection::InitControlLayout() { - GridLayout* layout = new GridLayout(this); - SetLayoutManager(layout); - - int single_column_layout_id = 0; - ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); - column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, - GridLayout::USE_PREF, 0, 0); - int inset_column_layout_id = 1; - column_set = layout->AddColumnSet(inset_column_layout_id); - column_set->AddPaddingColumn(0, kUnrelatedControlHorizontalSpacing); - column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 1, - GridLayout::USE_PREF, 0, 0); - - layout->StartRow(0, single_column_layout_id); - views::Label* title_label = new views::Label( - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_TOUCHPAD)); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::Font title_font = - rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD); - title_label->SetFont(title_font); - layout->AddView(title_label); - layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(0, inset_column_layout_id); - InitContents(); - layout->AddView(contents_); -} - -void TouchpadSection::InitContents() { - contents_ = new views::View; - GridLayout* layout = new GridLayout(contents_); - contents_->SetLayoutManager(layout); - +void TouchpadSection::InitContents(GridLayout* layout) { enable_tap_to_click_checkbox_ = new views::Checkbox(l10n_util::GetString( IDS_OPTIONS_SETTINGS_TAP_TO_CLICK_ENABLED_DESCRIPTION)); enable_tap_to_click_checkbox_->set_listener(this); @@ -404,33 +531,20 @@ void TouchpadSection::InitContents() { views::Slider::STYLE_UPDATE_ON_RELEASE), this); - int single_column_view_set_id = 0; - ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); - column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, - GridLayout::USE_PREF, 0, 0); - - int double_column_view_set_id = 1; - column_set = layout->AddColumnSet(double_column_view_set_id); - column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, - GridLayout::USE_PREF, 0, 0); - column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); - column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, - GridLayout::USE_PREF, 0, 0); - - layout->StartRow(0, double_column_view_set_id); + layout->StartRow(0, double_column_view_set_id()); layout->AddView(new views::Label( l10n_util::GetString(IDS_OPTIONS_SETTINGS_SENSITIVITY_DESCRIPTION))); layout->AddView(sensitivity_slider_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(0, double_column_view_set_id); + layout->StartRow(0, double_column_view_set_id()); layout->AddView(new views::Label( l10n_util::GetString(IDS_OPTIONS_SETTINGS_SPEED_FACTOR_DESCRIPTION))); layout->AddView(speed_factor_slider_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(0, single_column_view_set_id); + layout->StartRow(0, single_column_view_set_id()); layout->AddView(enable_tap_to_click_checkbox_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(0, single_column_view_set_id); + layout->StartRow(0, single_column_view_set_id()); layout->AddView(enable_vert_edge_scroll_checkbox_); layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); @@ -482,6 +596,9 @@ void SettingsContentsView::InitControlLayout() { GridLayout::USE_PREF, 0, 0); layout->StartRow(0, single_column_view_set_id); + layout->AddView(new DateTimeSection(profile())); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + layout->StartRow(0, single_column_view_set_id); layout->AddView(new NetworkSection(profile())); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, single_column_view_set_id); diff --git a/chrome/browser/chromeos/status_area_view.cc b/chrome/browser/chromeos/status_area_view.cc index d618d9b..d296d57 100755 --- a/chrome/browser/chromeos/status_area_view.cc +++ b/chrome/browser/chromeos/status_area_view.cc @@ -126,7 +126,7 @@ void StatusAreaView::Init() { ThemeProvider* theme = browser_->profile()->GetThemeProvider(); // Clock. - clock_view_ = new ClockMenuButton(); + clock_view_ = new ClockMenuButton(browser_); AddChildView(clock_view_); // Network. diff --git a/chrome/browser/chromeos/touchpad.cc b/chrome/browser/chromeos/touchpad.cc index e5146b0..ccb1eb9 100644 --- a/chrome/browser/chromeos/touchpad.cc +++ b/chrome/browser/chromeos/touchpad.cc @@ -8,69 +8,19 @@ #include <string> #include <vector> -#include "base/string_util.h" #include "base/process_util.h" +#include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/common/notification_service.h" -#include "chrome/common/pref_member.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/pref_service.h" - -// Allows InvokeLater without adding refcounting. The object is only deleted -// when its last InvokeLater is run anyway. -template <> -struct RunnableMethodTraits<Touchpad> { - void RetainCallee(Touchpad*) {} - void ReleaseCallee(Touchpad*) {} -}; // static -void Touchpad::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, false); - prefs->RegisterBooleanPref(prefs::kVertEdgeScrollEnabled, false); - prefs->RegisterIntegerPref(prefs::kTouchpadSpeedFactor, 5); - prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, 5); -} - -void Touchpad::Init(PrefService* prefs) { - tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); - vert_edge_scroll_enabled_.Init(prefs::kVertEdgeScrollEnabled, prefs, this); - speed_factor_.Init(prefs::kTouchpadSpeedFactor, prefs, this); - sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); - - // Initialize touchpad settings to what's saved in user preferences. - SetTapToClick(); - SetVertEdgeScroll(); - SetSpeedFactor(); - SetSensitivity(); -} - -void Touchpad::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) - NotifyPrefChanged(Details<std::wstring>(details).ptr()); -} - -void Touchpad::NotifyPrefChanged(const std::wstring* pref_name) { - if (!pref_name || *pref_name == prefs::kTapToClickEnabled) - SetTapToClick(); - if (!pref_name || *pref_name == prefs::kVertEdgeScrollEnabled) - SetVertEdgeScroll(); - if (!pref_name || *pref_name == prefs::kTouchpadSpeedFactor) - SetSpeedFactor(); - if (!pref_name || *pref_name == prefs::kTouchpadSensitivity) - SetSensitivity(); -} - void Touchpad::SetSynclientParam(const std::string& param, double value) { // If not running on the file thread, then re-run on the file thread. if (!ChromeThread::CurrentlyOn(ChromeThread::FILE)) { base::Thread* file_thread = g_browser_process->file_thread(); if (file_thread) file_thread->message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(this, &Touchpad::SetSynclientParam, param, value)); + NewRunnableFunction(&Touchpad::SetSynclientParam, param, value)); } else { // launch binary synclient to set the parameter std::vector<std::string> argv; @@ -83,31 +33,33 @@ void Touchpad::SetSynclientParam(const std::string& param, double value) { } } -void Touchpad::SetTapToClick() { +// static +void Touchpad::SetTapToClick(bool value) { // To disable tap-to-click (i.e. a tap on the touchpad is recognized as a left // mouse click event), we set MaxTapTime to 0. MaxTapTime is the maximum time // (in milliseconds) for detecting a tap. The default is 180. - if (tap_to_click_enabled_.GetValue()) + if (value) SetSynclientParam("MaxTapTime", 180); else SetSynclientParam("MaxTapTime", 0); } -void Touchpad::SetVertEdgeScroll() { +// static +void Touchpad::SetVertEdgeScroll(bool value) { // To disable vertical edge scroll, we set VertEdgeScroll to 0. Vertical edge // scroll lets you use the right edge of the touchpad to control the movement // of the vertical scroll bar. - if (vert_edge_scroll_enabled_.GetValue()) + if (value) SetSynclientParam("VertEdgeScroll", 1); else SetSynclientParam("VertEdgeScroll", 0); } -void Touchpad::SetSpeedFactor() { +// static +void Touchpad::SetSpeedFactor(int value) { // To set speed factor, we use MaxSpeed. MinSpeed is set to 0.2. // MaxSpeed can go from 0.2 to 1.1. The preference is an integer between // 1 and 10, so we divide that by 10 and add 0.1 for the value of MaxSpeed. - int value = speed_factor_.GetValue(); if (value < 1) value = 1; if (value > 10) @@ -117,13 +69,13 @@ void Touchpad::SetSpeedFactor() { SetSynclientParam("MaxSpeed", d); } -void Touchpad::SetSensitivity() { +// static +void Touchpad::SetSensitivity(int value) { // To set the touch sensitivity, we use FingerHigh, which represents the // the pressure needed for a tap to be registered. The range of FingerHigh // goes from 25 to 70. We store the sensitivity preference as an int from // 1 to 10. So we need to map the preference value of 1 to 10 to the // FingerHigh value of 25 to 70 inversely. - int value = sensitivity_.GetValue(); if (value < 1) value = 1; if (value > 10) diff --git a/chrome/browser/chromeos/touchpad.h b/chrome/browser/chromeos/touchpad.h index 17171c3..bf861e8 100644 --- a/chrome/browser/chromeos/touchpad.h +++ b/chrome/browser/chromeos/touchpad.h @@ -7,62 +7,27 @@ #include <string> -#include "chrome/common/notification_observer.h" -#include "chrome/common/pref_member.h" - -class PrefService; - -// The Touchpad class handles touchpad preferences. When the class is first -// initialized, it will initialize the touchpad settings to what's stored in the -// preferences. And whenever the preference changes, we change the touchpad -// setting to reflect the new value. -// // For Synaptics touchpads, we use synclient to change settings on-the-fly. // See "man synaptics" for a list of settings that can be changed. // Since we are doing a system call to run the synclient binary, we make sure // that we are running on the File thread so that we don't block the UI thread. -class Touchpad : public NotificationObserver { +class Touchpad { public: - explicit Touchpad() {} - virtual ~Touchpad() {} - - // This method will register the prefs associated with touchpad settings. - static void RegisterUserPrefs(PrefService* prefs); - - // This method will initialize touchpad settings to values in user prefs. - virtual void Init(PrefService* prefs); - - // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - protected: - virtual void NotifyPrefChanged(const std::wstring* pref_name); - - private: // This methods makes a system call to synclient to change touchpad settings. // The system call will be invoked on the file thread. - void SetSynclientParam(const std::string& param, double value); + static void SetSynclientParam(const std::string& param, double value); // Set tap-to-click to value stored in preferences. - void SetTapToClick(); + static void SetTapToClick(bool value); // Set vertical edge scrolling to value stored in preferences. - void SetVertEdgeScroll(); + static void SetVertEdgeScroll(bool value); // Set touchpad speed factor to value stored in preferences. - void SetSpeedFactor(); + static void SetSpeedFactor(int value); // Set tap sensitivity to value stored in preferences. - void SetSensitivity(); - - BooleanPrefMember tap_to_click_enabled_; - BooleanPrefMember vert_edge_scroll_enabled_; - IntegerPrefMember speed_factor_; - IntegerPrefMember sensitivity_; - - DISALLOW_COPY_AND_ASSIGN(Touchpad); + static void SetSensitivity(int value); }; #endif // CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc index 764c0dc..258ac8e 100644 --- a/chrome/browser/options_util.cc +++ b/chrome/browser/options_util.cc @@ -31,6 +31,7 @@ void OptionsUtil::ResetToDefaults(Profile* profile) { prefs::kTLS1Enabled, #endif #if defined(OS_CHROMEOS) + prefs::kTimeZone, prefs::kTapToClickEnabled, prefs::kVertEdgeScrollEnabled, prefs::kTouchpadSpeedFactor, diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index c799d1a..501d6a5 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -60,7 +60,7 @@ #endif #if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/touchpad.h" +#include "chrome/browser/chromeos/preferences.h" #endif using base::Time; @@ -665,7 +665,7 @@ ProfileImpl::ProfileImpl(const FilePath& path) SSLConfigServiceManager::CreateDefaultManager(this)); #if defined(OS_CHROMEOS) - touchpad_.Init(prefs); + chromeos_preferences_.Init(prefs); #endif } @@ -916,7 +916,7 @@ PrefService* ProfileImpl::GetPrefs() { // Register Touchpad prefs here instead of in browser_prefs because these // prefs are used in the constructor of ProfileImpl which happens before // browser_prefs' RegisterAllPrefs is called. - Touchpad::RegisterUserPrefs(prefs_.get()); + chromeos::Preferences::RegisterUserPrefs(prefs_.get()); #endif // The last session exited cleanly if there is no pref for diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index a7107f4..2ab6233 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -18,7 +18,7 @@ #include "chrome/common/notification_registrar.h" #if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/touchpad.h" +#include "chrome/browser/chromeos/preferences.h" #endif namespace net { @@ -553,7 +553,7 @@ class ProfileImpl : public Profile, bool shutdown_session_service_; #if defined(OS_CHROMEOS) - Touchpad touchpad_; + chromeos::Preferences chromeos_preferences_; #endif DISALLOW_COPY_AND_ASSIGN(ProfileImpl); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 6bba4f0..49fcb6c 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -966,20 +966,22 @@ 'browser/chromeos/cros_network_library.h', 'browser/chromeos/cros_power_library.cc', 'browser/chromeos/cros_power_library.h', - 'browser/chromeos/main_menu.cc', - 'browser/chromeos/main_menu.h', - 'browser/chromeos/pipe_reader.cc', - 'browser/chromeos/pipe_reader.h', 'browser/chromeos/external_cookie_handler.cc', 'browser/chromeos/external_cookie_handler.h', 'browser/chromeos/gview_request_interceptor.cc', 'browser/chromeos/gview_request_interceptor.h', + 'browser/chromeos/main_menu.cc', + 'browser/chromeos/main_menu.h', 'browser/chromeos/network_menu_button.cc', 'browser/chromeos/network_menu_button.h', 'browser/chromeos/password_dialog_view.cc', 'browser/chromeos/password_dialog_view.h', + 'browser/chromeos/pipe_reader.cc', + 'browser/chromeos/pipe_reader.h', 'browser/chromeos/power_menu_button.cc', 'browser/chromeos/power_menu_button.h', + 'browser/chromeos/preferences.cc', + 'browser/chromeos/preferences.h', 'browser/chromeos/settings_contents_view.cc', 'browser/chromeos/settings_contents_view.h', 'browser/chromeos/settings_page_view.cc', diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index ee03bc3..8293cf5 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -182,6 +182,9 @@ extern const wchar_t kTLS1Enabled[] = L"ssl.tls1.enabled"; #endif #if defined(OS_CHROMEOS) +// A string pref set to the timezone. +extern const wchar_t kTimeZone[] = L"settings.datetime.timezone"; + // A boolean pref set to true if TapToClick is being done in browser. extern const wchar_t kTapToClickEnabled[] = L"settings.touchpad.enable_tap_to_click"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index f6d62ea..96eacaf 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -69,6 +69,7 @@ extern const wchar_t kSSL3Enabled[]; extern const wchar_t kTLS1Enabled[]; #endif #if defined(OS_CHROMEOS) +extern const wchar_t kTimeZone[]; extern const wchar_t kTapToClickEnabled[]; extern const wchar_t kVertEdgeScrollEnabled[]; extern const wchar_t kTouchpadSpeedFactor[]; |