summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/options/internet_page_view.cc597
-rw-r--r--chrome/browser/chromeos/options/internet_page_view.h49
-rw-r--r--chrome/browser/chromeos/options/options_window_view.cc392
-rw-r--r--chrome/browser/chromeos/options/options_window_view.h20
-rw-r--r--chrome/browser/chromeos/options/settings_page_view.cc99
-rw-r--r--chrome/browser/chromeos/options/settings_page_view.h64
-rw-r--r--chrome/browser/chromeos/options/system_page_view.cc402
-rw-r--r--chrome/browser/chromeos/options/system_page_view.h28
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc113
-rw-r--r--chrome/browser/ui/gtk/options/content_page_gtk.cc36
-rw-r--r--chrome/browser/ui/gtk/options/options_window_gtk.cc23
-rw-r--r--chrome/chrome_browser.gypi8
12 files changed, 3 insertions, 1828 deletions
diff --git a/chrome/browser/chromeos/options/internet_page_view.cc b/chrome/browser/chromeos/options/internet_page_view.cc
deleted file mode 100644
index 399caa3..0000000
--- a/chrome/browser/chromeos/options/internet_page_view.cc
+++ /dev/null
@@ -1,597 +0,0 @@
-// Copyright (c) 2011 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/options/internet_page_view.h"
-
-#include <string>
-
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/options/network_config_view.h"
-#include "chrome/browser/chromeos/options/options_window_view.h"
-#include "chrome/browser/chromeos/status/network_menu.h"
-#include "chrome/browser/ui/views/window.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "views/controls/button/native_button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/image_view.h"
-#include "views/controls/scroll_view.h"
-#include "views/layout/layout_constants.h"
-#include "views/widget/widget.h"
-#include "views/window/window.h"
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkSection
-
-class NetworkSection : public SettingsPageSection,
- public views::ButtonListener {
- public:
- NetworkSection(InternetPageContentView* parent, Profile* profile,
- int title_msg_id);
- virtual ~NetworkSection() {}
-
- // Overriden from views::Button::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- void RefreshContents();
-
- protected:
- enum ButtonFlags {
- OPTIONS_BUTTON = 1 << 0,
- CONNECT_BUTTON = 1 << 1,
- DISCONNECT_BUTTON = 1 << 2,
- FORGET_BUTTON = 1 << 3,
- };
-
- // SettingsPageSection overrides:
- virtual void InitContents(GridLayout* layout);
-
- // Subclasses will initialize themselves in this method.
- virtual void InitSection() = 0;
-
- // This adds a row for a network.
- // |id| is passed back in the ButtonClicked method.
- // |icon|, |name|, |bold_name|, and |status| are displayed in the row.
- // |button_flags| is an OR of ButtonFlags that should be displayed.
- void AddNetwork(int id, const SkBitmap& icon, const std::wstring& name,
- bool bold_name, const std::wstring& status, int button_flags,
- int connection_type);
-
- // Creates a modal popup with |view|.
- void CreateModalPopup(views::WindowDelegate* view);
-
- // This method is called when the user click on the |button| for |id|.
- virtual void ButtonClicked(int button, int connection_type, int id) = 0;
-
- private:
- // This constant determines the button tag offset for the different buttons.
- // The ButtonFlag is multiplied by this offset to determine the button tag.
- // For example, for disconnect buttons (DISCONNECT_BUTTON = 4), the button tag
- // will be offset by 4000.
- static const int kButtonIdOffset = 1000;
- // This constant determines the button tag offset for the connection types.
- // The ConnectionType is multiplied by this to determine the button tag.
- // For example, for wifi buttons (TYPE_WIFI = 2), the button tag
- // will be offset by 200.
- static const int kConnectionTypeOffset = 100;
-
- InternetPageContentView* parent_;
-
- int quad_column_view_set_id_;
-
- GridLayout* layout_;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkSection);
-};
-
-NetworkSection::NetworkSection(InternetPageContentView* parent,
- Profile* profile,
- int title_msg_id)
- : SettingsPageSection(profile, title_msg_id),
- parent_(parent),
- quad_column_view_set_id_(1) {
-}
-
-void NetworkSection::ButtonPressed(views::Button* sender,
- const views::Event& event) {
- int id = sender->tag();
- // Determine the button from the id (div by kButtonIdOffset).
- int button = id / kButtonIdOffset;
- id %= kButtonIdOffset;
- // Determine the connection type from the id (div by kConnectionTypeOffset).
- int connection_type = id / kConnectionTypeOffset;
- id %= kConnectionTypeOffset;
-
- ButtonClicked(button, connection_type, id);
-}
-
-void NetworkSection::RefreshContents() {
- RemoveAllChildViews(true);
- InitControlLayout();
-}
-
-void NetworkSection::InitContents(GridLayout* layout) {
- layout_ = layout;
-
- ColumnSet* column_set = layout_->AddColumnSet(quad_column_view_set_id_);
- // icon
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- GridLayout::USE_PREF, 0, 0);
- // network name
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- GridLayout::USE_PREF, 0, 0);
- // fill padding
- column_set->AddPaddingColumn(10, 0);
- // first button
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- GridLayout::USE_PREF, 0, 0);
- // padding
- column_set->AddPaddingColumn(0, 10);
- // second button
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- GridLayout::USE_PREF, 0, 0);
-
- InitSection();
-}
-
-void NetworkSection::AddNetwork(int id, const SkBitmap& icon,
- const std::wstring& name, bool bold_name,
- const std::wstring& status, int button_flags,
- int connection_type) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-
- // Offset id by connection type.
- id += kConnectionTypeOffset * connection_type;
-
- layout_->StartRow(0, quad_column_view_set_id_);
- views::ImageView* icon_view = new views::ImageView();
- icon_view->SetImage(icon);
- layout_->AddView(icon_view, 1, 2);
-
- views::Label* name_view = new views::Label(name);
- if (bold_name)
- name_view->SetFont(rb.GetFont(ResourceBundle::BoldFont));
- name_view->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- layout_->AddView(name_view);
-
- int num_buttons = 0;
- if (button_flags & OPTIONS_BUTTON)
- num_buttons++;
- if (button_flags & CONNECT_BUTTON)
- num_buttons++;
- if (button_flags & DISCONNECT_BUTTON)
- num_buttons++;
- if (button_flags & FORGET_BUTTON)
- num_buttons++;
-
- if (num_buttons > 0) {
- // We only support 2 buttons.
- DCHECK_LE(num_buttons, 2);
-
- if (num_buttons == 1)
- layout_->SkipColumns(1);
-
- if (button_flags & FORGET_BUTTON) {
- views::NativeButton* button = new views::NativeButton(this,
- UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_FORGET)));
- button->set_tag(id + kButtonIdOffset * FORGET_BUTTON);
- layout_->AddView(button, 1, 2);
- }
-
- if (button_flags & DISCONNECT_BUTTON) {
- views::NativeButton* button = new views::NativeButton(this, UTF16ToWide(
- l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_DISCONNECT)));
- button->set_tag(id + kButtonIdOffset * DISCONNECT_BUTTON);
- layout_->AddView(button, 1, 2);
- }
-
- if (button_flags & CONNECT_BUTTON) {
- views::NativeButton* button = new views::NativeButton(this,
- UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_CONNECT)));
- button->set_tag(id + kButtonIdOffset * CONNECT_BUTTON);
- layout_->AddView(button, 1, 2);
- }
-
- if (button_flags & OPTIONS_BUTTON) {
- views::NativeButton* button = new views::NativeButton(this,
- UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS)));
- button->set_tag(id + kButtonIdOffset * OPTIONS_BUTTON);
- layout_->AddView(button, 1, 2);
- }
- }
-
- layout_->StartRow(0, quad_column_view_set_id_);
- layout_->SkipColumns(1);
- views::Label* status_label = new views::Label(status);
- status_label->SetFont(rb.GetFont(ResourceBundle::SmallFont));
- status_label->SetColor(SK_ColorLTGRAY);
- status_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- layout_->AddView(status_label);
- layout_->AddPaddingRow(0, kRelatedControlVerticalSpacing);
-}
-
-void NetworkSection::CreateModalPopup(views::WindowDelegate* view) {
- views::Window* window = browser::CreateViewsWindow(
- GetOptionsViewParent(), gfx::Rect(), view);
- window->SetIsAlwaysOnTop(true);
- window->Show();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WiredSection
-
-class WiredSection : public NetworkSection {
- public:
- WiredSection(InternetPageContentView* parent, Profile* profile);
- virtual ~WiredSection() {}
-
- protected:
- // NetworkSection overrides:
- virtual void InitSection();
- virtual void ButtonClicked(int button, int connection_type, int id);
-
- DISALLOW_COPY_AND_ASSIGN(WiredSection);
-};
-
-WiredSection::WiredSection(InternetPageContentView* parent, Profile* profile)
- : NetworkSection(parent, profile,
- IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRED_NETWORK) {
-}
-
-void WiredSection::InitSection() {
- NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-
- SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK);
- if (!cros->ethernet_connecting() && !cros->ethernet_connected()) {
- icon = NetworkMenu::IconForDisplay(icon,
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
- }
-
- std::wstring name = UTF16ToWide(
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
-
- int s = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED;
- if (cros->ethernet_connecting())
- s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
- else if (cros->ethernet_connected())
- s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
- else if (cros->ethernet_enabled())
- s = IDS_STATUSBAR_NETWORK_DEVICE_DISCONNECTED;
- std::wstring status = UTF16ToWide(l10n_util::GetStringUTF16(s));
-
- int flags = cros->ethernet_connected() ? OPTIONS_BUTTON : 0;
- bool bold = cros->ethernet_connected() ? true : false;
- AddNetwork(0, icon, name, bold, status, flags, TYPE_ETHERNET);
-}
-
-void WiredSection::ButtonClicked(int button, int connection_type, int id) {
-// CreateModalPopup(new NetworkConfigView(
-// CrosLibrary::Get()->GetNetworkLibrary()->ethernet_network()));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WirelessSection
-
-class WirelessSection : public NetworkSection {
- public:
- WirelessSection(InternetPageContentView* parent, Profile* profile);
- virtual ~WirelessSection() {}
-
- protected:
- // NetworkSection overrides:
- virtual void InitSection();
- virtual void ButtonClicked(int button, int connection_type, int id);
-
- private:
- // This calls NetworkSection::AddNetwork .
- // For |connecting| or |connected| networks, the name is bold.
- // The status is "Connecting" if |connecting|, "Connected" if |connected|,
- // or "Disconnected".
- // For connected networks, we show the disconnect and options buttons.
- // For !connected and !connecting networks, we show the connect button.
- void AddWirelessNetwork(int id, const SkBitmap& icon,
- const std::wstring& name, bool connecting,
- bool connected, int connection_type);
-
- WifiNetworkVector wifi_networks_;
- CellularNetworkVector cellular_networks_;
-
- DISALLOW_COPY_AND_ASSIGN(WirelessSection);
-};
-
-WirelessSection::WirelessSection(InternetPageContentView* parent,
- Profile* profile)
- : NetworkSection(parent, profile,
- IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRELESS_NETWORK) {
-}
-
-void WirelessSection::InitSection() {
- NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-
- // Wifi
- wifi_networks_ = cros->wifi_networks();
- for (size_t i = 0; i < wifi_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(wifi_networks_[i]->name());
-
- SkBitmap icon = NetworkMenu::IconForNetworkStrength(
- wifi_networks_[i], true);
- if (wifi_networks_[i]->encrypted()) {
- icon = NetworkMenu::IconForDisplay(icon,
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
- }
-
- bool connecting = wifi_networks_[i]->connecting();
- bool connected = wifi_networks_[i]->connected();
- AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_WIFI);
- }
-
- // Cellular
- cellular_networks_ = cros->cellular_networks();
- for (size_t i = 0; i < cellular_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(cellular_networks_[i]->name());
-
- SkBitmap icon = NetworkMenu::IconForNetworkStrength(
- cellular_networks_[i], true);
- SkBitmap badge =
- NetworkMenu::BadgeForNetworkTechnology(cellular_networks_[i]);
- icon = NetworkMenu::IconForDisplay(icon, badge);
-
- bool connecting = cellular_networks_[i]->connecting();
- bool connected = cellular_networks_[i]->connected();
- AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_CELLULAR);
- }
-}
-
-void WirelessSection::ButtonClicked(int button, int connection_type, int id) {
- if (connection_type == TYPE_CELLULAR) {
- if (static_cast<int>(cellular_networks_.size()) > id) {
- if (button == CONNECT_BUTTON) {
- // Connect to cellular network.
- CrosLibrary::Get()->GetNetworkLibrary()->ConnectToCellularNetwork(
- cellular_networks_[id]);
- } else if (button == DISCONNECT_BUTTON) {
- CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromWirelessNetwork(
- cellular_networks_[id]);
- } else {
-// CreateModalPopup(new NetworkConfigView(cellular_networks_[id]));
- }
- }
- } else if (connection_type == TYPE_WIFI) {
- if (static_cast<int>(wifi_networks_.size()) > id) {
- if (button == CONNECT_BUTTON) {
- // Connect to wifi here. Open password page if appropriate.
- if (wifi_networks_[id]->encrypted()) {
-// NetworkConfigView* view =
-// new NetworkConfigView(wifi_networks_[id], true);
-// CreateModalPopup(view);
-// view->SetLoginTextfieldFocus();
- } else {
- CrosLibrary::Get()->GetNetworkLibrary()->ConnectToWifiNetwork(
- wifi_networks_[id], std::string(), std::string(), std::string());
- }
- } else if (button == DISCONNECT_BUTTON) {
- CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromWirelessNetwork(
- wifi_networks_[id]);
- } else {
-// CreateModalPopup(new NetworkConfigView(wifi_networks_[id], false));
- }
- }
- } else {
- NOTREACHED();
- }
-}
-
-void WirelessSection::AddWirelessNetwork(int id, const SkBitmap& icon,
- const std::wstring& name, bool connecting, bool connected,
- int connection_type) {
- bool bold = connecting || connected;
-
- int s = IDS_STATUSBAR_NETWORK_DEVICE_DISCONNECTED;
- if (connecting)
- s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
- else if (connected)
- s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
- std::wstring status = UTF16ToWide(l10n_util::GetStringUTF16(s));
-
- int flags = 0;
- if (connected) {
- flags |= DISCONNECT_BUTTON | OPTIONS_BUTTON;
- } else if (!connecting) {
- flags |= CONNECT_BUTTON;
- }
-
- AddNetwork(id, icon, name, bold, status, flags, connection_type);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// RememberedSection
-
-class RememberedSection : public NetworkSection {
- public:
- RememberedSection(InternetPageContentView* parent, Profile* profile);
- virtual ~RememberedSection() {}
-
- protected:
- // NetworkSection overrides:
- virtual void InitSection();
- virtual void ButtonClicked(int button, int connection_type, int id);
-
- private:
- WifiNetworkVector wifi_networks_;
-
- DISALLOW_COPY_AND_ASSIGN(RememberedSection);
-};
-
-RememberedSection::RememberedSection(InternetPageContentView* parent,
- Profile* profile)
- : NetworkSection(parent, profile,
- IDS_OPTIONS_SETTINGS_SECTION_TITLE_REMEMBERED_NETWORK) {
-}
-
-void RememberedSection::InitSection() {
- NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-
- // Wifi
- wifi_networks_ = cros->remembered_wifi_networks();
- for (size_t i = 0; i < wifi_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(wifi_networks_[i]->name());
-
- SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0_BLACK);
- if (wifi_networks_[i]->encrypted()) {
- icon = NetworkMenu::IconForDisplay(icon,
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
- }
-
- AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON, TYPE_WIFI);
- }
-}
-
-void RememberedSection::ButtonClicked(int button, int connection_type, int id) {
- if (connection_type == TYPE_WIFI) {
- if (static_cast<int>(wifi_networks_.size()) > id) {
- CrosLibrary::Get()->GetNetworkLibrary()->ForgetWifiNetwork(
- wifi_networks_[id]->service_path());
- }
- } else {
- NOTREACHED();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// InternetPageContentView
-
-class InternetPageContentView : public SettingsPageView {
- public:
- explicit InternetPageContentView(Profile* profile);
- virtual ~InternetPageContentView() {}
-
- virtual void RefreshContents();
-
- // views::View overrides.
- virtual int GetLineScrollIncrement(views::ScrollView* scroll_view,
- bool is_horizontal, bool is_positive);
- virtual void Layout();
- virtual void DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current);
-
- protected:
- // SettingsPageView implementation:
- virtual void InitControlLayout();
-
- private:
- int line_height_;
- WiredSection* wired_section_;
- WirelessSection* wireless_section_;
- RememberedSection* remembered_section_;
-
- DISALLOW_COPY_AND_ASSIGN(InternetPageContentView);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// InternetPageContentView, SettingsPageView implementation:
-
-InternetPageContentView::InternetPageContentView(Profile* profile)
- : SettingsPageView(profile) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- line_height_ = rb.GetFont(ResourceBundle::BaseFont).GetHeight();
-}
-
-void InternetPageContentView::RefreshContents() {
- wired_section_->RefreshContents();
- wireless_section_->RefreshContents();
- remembered_section_->RefreshContents();
-}
-
-int InternetPageContentView::GetLineScrollIncrement(
- views::ScrollView* scroll_view,
- bool is_horizontal,
- bool is_positive) {
- if (!is_horizontal)
- return line_height_;
- return View::GetPageScrollIncrement(scroll_view, is_horizontal, is_positive);
-}
-
-void InternetPageContentView::Layout() {
- // Set the width to the parent width and the height to the preferred height.
- // We will have a vertical scrollbar if the preferred height is longer
- // than the parent's height.
- SetBounds(0, 0, GetParent()->width(), GetPreferredSize().height());
- View::Layout();
-}
-
-void InternetPageContentView::DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current) {
- // Override to do nothing. Calling Layout() interferes with our scrolling.
-}
-
-void InternetPageContentView::InitControlLayout() {
- GridLayout* layout = GridLayout::CreatePanel(this);
- SetLayoutManager(layout);
-
- int single_column_view_set_id = 0;
- ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id);
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- GridLayout::USE_PREF, 0, 0);
-
- layout->StartRow(0, single_column_view_set_id);
- wired_section_ = new WiredSection(this, profile());
- layout->AddView(wired_section_);
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
-
- layout->StartRow(0, single_column_view_set_id);
- wireless_section_ = new WirelessSection(this, profile());
- layout->AddView(wireless_section_);
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
-
- layout->StartRow(0, single_column_view_set_id);
- remembered_section_ = new RememberedSection(this, profile());
- layout->AddView(remembered_section_);
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// InternetPageView
-
-InternetPageView::InternetPageView(Profile* profile)
- : SettingsPageView(profile),
- contents_view_(new InternetPageContentView(profile)),
- scroll_view_(new views::ScrollView) {
- NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
- cros->AddNetworkManagerObserver(this);
-}
-
-InternetPageView::~InternetPageView() {
- CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this);
-}
-
-void InternetPageView::OnNetworkManagerChanged(NetworkLibrary* obj) {
- // Refresh wired, wireless, and remembered networks.
- // Remember the current scroll region, and try to scroll back afterwards.
- gfx::Rect rect = scroll_view_->GetVisibleRect();
- contents_view_->RefreshContents();
- Layout();
- scroll_view_->ScrollContentsRegionToBeVisible(rect);
-}
-
-void InternetPageView::Layout() {
- contents_view_->Layout();
- scroll_view_->SetBounds(GetLocalBounds(false));
- scroll_view_->Layout();
-}
-
-void InternetPageView::InitControlLayout() {
- AddChildView(scroll_view_);
- scroll_view_->SetContents(contents_view_);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/options/internet_page_view.h b/chrome/browser/chromeos/options/internet_page_view.h
deleted file mode 100644
index c5048df..0000000
--- a/chrome/browser/chromeos/options/internet_page_view.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2006-2008 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_OPTIONS_INTERNET_PAGE_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_OPTIONS_INTERNET_PAGE_VIEW_H_
-#pragma once
-
-#include "chrome/browser/chromeos/cros/network_library.h"
-#include "chrome/browser/chromeos/options/settings_page_view.h"
-
-namespace views {
-class ScrollView;
-} // namespace views
-
-namespace chromeos {
-
-class InternetPageContentView;
-
-// Internet settings page for Chrome OS
-class InternetPageView : public SettingsPageView,
- public NetworkLibrary::NetworkManagerObserver {
- public:
- explicit InternetPageView(Profile* profile);
- virtual ~InternetPageView();
-
- // NetworkLibrary::NetworkManagerObserver implementation.
- virtual void OnNetworkManagerChanged(NetworkLibrary* obj);
-
- // views::View overrides:
- virtual void Layout();
-
- protected:
- // SettingsPageView implementation:
- virtual void InitControlLayout();
-
- private:
- // The contents of the internet page view.
- InternetPageContentView* contents_view_;
-
- // The scroll view that contains the advanced options.
- views::ScrollView* scroll_view_;
-
- DISALLOW_COPY_AND_ASSIGN(InternetPageView);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_OPTIONS_INTERNET_PAGE_VIEW_H_
diff --git a/chrome/browser/chromeos/options/options_window_view.cc b/chrome/browser/chromeos/options/options_window_view.cc
deleted file mode 100644
index 1cc4a62..0000000
--- a/chrome/browser/chromeos/options/options_window_view.cc
+++ /dev/null
@@ -1,392 +0,0 @@
-// Copyright (c) 2011 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 "base/scoped_ptr.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/options/internet_page_view.h"
-#include "chrome/browser/chromeos/options/system_page_view.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/gtk/options/advanced_page_gtk.h"
-#include "chrome/browser/ui/gtk/options/content_page_gtk.h"
-#include "chrome/browser/ui/gtk/options/general_page_gtk.h"
-#include "chrome/browser/ui/options/options_window.h"
-#include "chrome/browser/ui/views/accessible_view_helper.h"
-#include "chrome/browser/ui/views/window.h"
-#include "chrome/browser/ui/window_sizer.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/pref_names.h"
-#include "grit/chromium_strings.h"
-#include "grit/generated_resources.h"
-#include "grit/locale_settings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "views/controls/native/native_view_host.h"
-#include "views/controls/tabbed_pane/native_tabbed_pane_gtk.h"
-#include "views/controls/tabbed_pane/tabbed_pane.h"
-#include "views/widget/root_view.h"
-#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
-#include "views/window/window_gtk.h"
-
-
-namespace chromeos {
-
-///////////////////////////////////////////////////////////////////////////////
-// GtkPreferencePageHost
-//
-// Hosts a GTK preference page and takes care of sizing it appropriately.
-//
-class GtkPreferencePageHost : public views::NativeViewHost {
- public:
- explicit GtkPreferencePageHost(GtkWidget* widget);
-
- private:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
- virtual gfx::Size GetPreferredSize();
-
- GtkWidget* widget_;
-
- DISALLOW_COPY_AND_ASSIGN(GtkPreferencePageHost);
-};
-
-GtkPreferencePageHost::GtkPreferencePageHost(GtkWidget* widget)
- : widget_(widget) {
- set_background(views::Background::CreateSolidBackground(SK_ColorWHITE));
-}
-
-void GtkPreferencePageHost::ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) {
- NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
- if (is_add && child == this)
- Attach(widget_);
-}
-
-gfx::Size GtkPreferencePageHost::GetPreferredSize() {
- // We need to show the widget and its children since otherwise containers like
- // gtk_box don't compute the correct size.
- gtk_widget_show_all(widget_);
- GtkRequisition requisition = { 0, 0 };
- gtk_widget_size_request(GTK_WIDGET(widget_), &requisition);
- GtkRequisition& size(widget_->requisition);
- return gfx::Size(size.width, size.height);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// OptionsWindowView
-//
-// The contents of the Options dialog window.
-//
-class OptionsWindowView : public views::View,
- public views::DialogDelegate,
- public views::TabbedPane::Listener {
- public:
- static const int kDialogPadding;
- static const SkColor kDialogBackground;
- static OptionsWindowView* instance_;
-
- explicit OptionsWindowView(Profile* profile);
- virtual ~OptionsWindowView();
-
- // Shows the Tab corresponding to the specified OptionsPage.
- void ShowOptionsPage(OptionsPage page, OptionsGroup highlight_group);
-
- // views::DialogDelegate implementation:
- virtual int GetDialogButtons() const {
- return 0;
- }
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual bool Cancel();
- virtual views::View* GetContentsView();
- virtual bool ShouldShowClientEdge() const {
- return false;
- }
-
- // views::TabbedPane::Listener implementation:
- virtual void TabSelectedAt(int index);
-
- // views::View overrides:
- virtual void Layout();
- virtual gfx::Size GetPreferredSize();
-
- protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
- private:
- // Init the assorted Tabbed pages
- void Init();
-
- // Returns the currently selected OptionsPageView.
- OptionsPageView* GetCurrentOptionsPageView() const;
-
- // Flag of whether we are fully initialized.
- bool initialized_;
-
- // The Tab view that contains all of the options pages.
- views::TabbedPane* tabs_;
-
- // The Profile associated with these options.
- Profile* profile_;
-
- // Native Gtk options pages.
- GeneralPageGtk general_page_;
- ContentPageGtk content_page_;
- AdvancedPageGtk advanced_page_;
-
- // The last page the user was on when they opened the Options window.
- IntegerPrefMember last_selected_page_;
-
- scoped_ptr<AccessibleViewHelper> accessible_view_helper_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(OptionsWindowView);
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// OptionsWindowView, public:
-
-// No dialog padding.
-const int OptionsWindowView::kDialogPadding = 0;
-
-// Shaded frame color that matches the rendered frame. It's the result
-// of SRC_OVER frame top center image on top of frame color.
-const SkColor OptionsWindowView::kDialogBackground =
- SkColorSetRGB(0x4E, 0x7D, 0xD0);
-
-// Live instance of the options view.
-OptionsWindowView* OptionsWindowView::instance_ = NULL;
-
-OptionsWindowView::OptionsWindowView(Profile* profile)
- // Always show preferences for the original profile. Most state when off
- // the record comes from the original profile, but we explicitly use
- // the original profile to avoid potential problems.
- : initialized_(false),
- tabs_(NULL),
- profile_(profile->GetOriginalProfile()),
- general_page_(profile_),
- content_page_(profile_),
- advanced_page_(profile_) {
- // We don't need to observe changes in this value.
- last_selected_page_.Init(prefs::kOptionsWindowLastTabIndex,
- g_browser_process->local_state(), NULL);
-
- set_background(views::Background::CreateSolidBackground(kDialogBackground));
-}
-
-OptionsWindowView::~OptionsWindowView() {
-}
-
-void OptionsWindowView::ShowOptionsPage(OptionsPage page,
- OptionsGroup highlight_group) {
- // This will show invisible windows and bring visible windows to the front.
- window()->Show();
-
- // Show all controls in tab after tab's size is allocated. We have
- // to do this after size allocation otherwise WrapLabelAtAllocationHack
- // in ContentPageGtk would break.
- GtkWidget* notebook = static_cast<views::NativeTabbedPaneGtk*>(
- tabs_->native_wrapper())->native_view();
- gtk_widget_show_all(notebook);
-
- if (page == OPTIONS_PAGE_DEFAULT) {
- // Remember the last visited page from local state.
- page = static_cast<OptionsPage>(last_selected_page_.GetValue());
- if (page == OPTIONS_PAGE_DEFAULT)
- page = OPTIONS_PAGE_GENERAL;
- }
- // If the page number is out of bounds, reset to the first tab.
- if (page < 0 || page >= tabs_->GetTabCount())
- page = OPTIONS_PAGE_GENERAL;
-
- tabs_->SelectTabAt(static_cast<int>(page));
-
- // TODO(xiyuan): set highlight_group
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// OptionsWindowView, views::DialogDelegate implementation:
-
-std::wstring OptionsWindowView::GetWindowTitle() const {
- return UTF16ToWide(
- l10n_util::GetStringFUTF16(IDS_OPTIONS_DIALOG_TITLE,
- l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
-}
-
-void OptionsWindowView::WindowClosing() {
- // Clear the static instance so that the next time ShowOptionsWindow() is
- // called a new window is opened.
- instance_ = NULL;
-}
-
-bool OptionsWindowView::Cancel() {
- OptionsPageView* selected_option_page = GetCurrentOptionsPageView();
- if (selected_option_page) {
- return selected_option_page->CanClose();
- } else {
- // Gtk option pages does not support CanClose.
- return true;
- }
-}
-
-views::View* OptionsWindowView::GetContentsView() {
- return this;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// OptionsWindowView, views::TabbedPane::Listener implementation:
-
-void OptionsWindowView::TabSelectedAt(int index) {
- if (!initialized_)
- return;
-
- DCHECK(index > OPTIONS_PAGE_DEFAULT && index < OPTIONS_PAGE_COUNT);
- last_selected_page_.SetValue(index);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// OptionsWindowView, views::View overrides:
-
-void OptionsWindowView::Layout() {
- tabs_->SetBounds(kDialogPadding, kDialogPadding,
- width() - (2 * kDialogPadding),
- height() - (2 * kDialogPadding));
- if (!accessible_view_helper_.get()) {
- accessible_view_helper_.reset(new AccessibleViewHelper(this, profile_));
- }
-}
-
-gfx::Size OptionsWindowView::GetPreferredSize() {
- gfx::Size size(tabs_->GetPreferredSize());
- size.Enlarge(2 * kDialogPadding, 2 * kDialogPadding);
- return size;
-}
-
-void OptionsWindowView::ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) {
- // Can't init before we're inserted into a Container, because we require a
- // HWND to parent native child controls to.
- if (is_add && child == this)
- Init();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// OptionsWindowView, private:
-
-void OptionsWindowView::Init() {
- tabs_ = new views::TabbedPane;
- tabs_->SetListener(this);
- AddChildView(tabs_);
-
- GtkWidget* notebook = static_cast<views::NativeTabbedPaneGtk*>(
- tabs_->native_wrapper())->native_view();
-
- // Set vertical padding of tab header.
- gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(notebook), 5);
-
- // Set a name for notebook. Note that the name is also used in theme engine
- // to apply specific drawings for this widget.
- gtk_widget_set_name(GTK_WIDGET(notebook), "chromeos-options-tab");
-
- // Setup tab pages.
- int tab_index = 0;
-
- SystemPageView* system_page = new SystemPageView(profile_);
- system_page->set_background(views::Background::CreateSolidBackground(
- SK_ColorWHITE));
- tabs_->AddTabAtIndex(tab_index++,
- UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_SYSTEM_TAB_LABEL)),
- system_page, false);
-
- InternetPageView* internet_page = new InternetPageView(profile_);
- internet_page->set_background(views::Background::CreateSolidBackground(
- SK_ColorWHITE));
- tabs_->AddTabAtIndex(tab_index++,
- UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_INTERNET_TAB_LABEL)),
- internet_page, false);
-
- tabs_->AddTabAtIndex(tab_index++,
- UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_GENERAL_TAB_LABEL)),
- new GtkPreferencePageHost(
- general_page_.get_page_widget()),
- false);
-
- tabs_->AddTabAtIndex(tab_index++,
- UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_CONTENT_TAB_LABEL)),
- new GtkPreferencePageHost(
- content_page_.get_page_widget()),
- false);
-
- tabs_->AddTabAtIndex(tab_index++,
- UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_ADVANCED_TAB_LABEL)),
- new GtkPreferencePageHost(
- advanced_page_.get_page_widget()),
- false);
-
- DCHECK(tabs_->GetTabCount() == OPTIONS_PAGE_COUNT);
-
- initialized_ = true;
-}
-
-OptionsPageView* OptionsWindowView::GetCurrentOptionsPageView() const {
- int selected_option_page = tabs_->GetSelectedTabIndex();
- if (selected_option_page < OPTIONS_PAGE_GENERAL) {
- return static_cast<OptionsPageView*>(tabs_->GetSelectedTab());
- } else {
- return NULL;
- }
-}
-
-void CloseOptionsWindow() {
- if (OptionsWindowView::instance_)
- OptionsWindowView::instance_->window()->Close();
-}
-
-gfx::NativeWindow GetOptionsViewParent() {
- if (Browser* b = BrowserList::GetLastActive()) {
- if (b->type() != Browser::TYPE_NORMAL) {
- b = BrowserList::FindBrowserWithType(b->profile(),
- Browser::TYPE_NORMAL,
- true);
- }
-
- if (b)
- return b->window()->GetNativeHandle();
- }
-
- return NULL;
-}
-
-}; // namespace chromeos
-
-///////////////////////////////////////////////////////////////////////////////
-// Factory/finder method:
-
-void ShowOptionsWindow(OptionsPage page,
- OptionsGroup highlight_group,
- Profile* profile) {
- DCHECK(profile);
-
- using chromeos::OptionsWindowView;
-
- // If there's already an existing options window, close it and create
- // a new one for the current active browser.
- chromeos::CloseOptionsWindow();
-
- OptionsWindowView::instance_ = new OptionsWindowView(profile);
- browser::CreateViewsWindow(chromeos::GetOptionsViewParent(),
- gfx::Rect(),
- OptionsWindowView::instance_);
-
- OptionsWindowView::instance_->ShowOptionsPage(page, highlight_group);
-}
diff --git a/chrome/browser/chromeos/options/options_window_view.h b/chrome/browser/chromeos/options/options_window_view.h
deleted file mode 100644
index 784ec8d..0000000
--- a/chrome/browser/chromeos/options/options_window_view.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2010 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_OPTIONS_OPTIONS_WINDOW_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_OPTIONS_OPTIONS_WINDOW_VIEW_H_
-#pragma once
-
-namespace chromeos {
-
-// Closes the options dialog.
-void CloseOptionsWindow();
-
-// Get a proper parent for options dialogs. This returns the last active browser
-// window for now.
-gfx::NativeWindow GetOptionsViewParent();
-
-}
-
-#endif // CHROME_BROWSER_CHROMEOS_OPTIONS_OPTIONS_WINDOW_VIEW_H_
diff --git a/chrome/browser/chromeos/options/settings_page_view.cc b/chrome/browser/chromeos/options/settings_page_view.cc
deleted file mode 100644
index e4321ed..0000000
--- a/chrome/browser/chromeos/options/settings_page_view.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2011 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/options/settings_page_view.h"
-
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "gfx/skia_utils_gtk.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "views/controls/label.h"
-#include "views/layout/fill_layout.h"
-#include "views/layout/layout_constants.h"
-#include "views/widget/widget_gtk.h"
-
-namespace chromeos {
-
-SettingsPageView::SettingsPageView(Profile* profile)
- : OptionsPageView(profile) {
- SetLayoutManager(new views::FillLayout());
-}
-
-GtkWidget* SettingsPageView::WrapInGtkWidget() {
- views::WidgetGtk* widget =
- new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD);
- widget->Init(NULL, gfx::Rect());
- widget->SetContentsView(this);
- // Set to a solid background with the same color as the widget's bg color.
- GtkStyle* window_style = gtk_widget_get_style(widget->GetNativeView());
- set_background(views::Background::CreateSolidBackground(
- gfx::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL])));
- widget->Show();
- // Removing the widget from the container results in unref'ing the widget. We
- // need to ref here otherwise the removal deletes the widget. The caller ends
- // up taking ownership.
- g_object_ref(widget->GetNativeView());
- GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView());
- gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView());
- return widget->GetNativeView();
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// SettingsPageSection
-
-SettingsPageSection::SettingsPageSection(Profile* profile, int title_msg_id)
- : OptionsPageView(profile),
- title_msg_id_(title_msg_id),
- // Using 1000 so that it does not clash with ids defined in subclasses.
- single_column_view_set_id_(1000),
- double_column_view_set_id_(1001) {
-}
-
-void SettingsPageSection::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(
- UTF16ToWide(l10n_util::GetStringUTF16(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);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/options/settings_page_view.h b/chrome/browser/chromeos/options/settings_page_view.h
deleted file mode 100644
index 052a632..0000000
--- a/chrome/browser/chromeos/options/settings_page_view.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2011 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_OPTIONS_SETTINGS_PAGE_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_OPTIONS_SETTINGS_PAGE_VIEW_H_
-#pragma once
-
-#include <gtk/gtk.h>
-
-#include "base/basictypes.h"
-#include "chrome/browser/ui/views/options/options_page_view.h"
-#include "views/layout/grid_layout.h"
-
-using views::ColumnSet;
-using views::GridLayout;
-
-namespace chromeos {
-
-class SettingsContentsView;
-
-// Settings page for Chrome OS.
-class SettingsPageView : public OptionsPageView {
- public:
- explicit SettingsPageView(Profile* profile);
-
- // Wraps the SettingsPageView in a GtkWidget and returns it. It's up to the
- // caller to delete (unref) the returned widget, which in turn deletes this
- // SettingsPageView.
- GtkWidget* WrapInGtkWidget();
-
- protected:
- virtual void InitControlLayout() = 0;
-
- DISALLOW_COPY_AND_ASSIGN(SettingsPageView);
-};
-
-// Base section class settings
-class SettingsPageSection : public OptionsPageView {
- public:
- explicit SettingsPageSection(Profile* profile, int title_msg_id);
- virtual ~SettingsPageSection() {}
-
- protected:
- // OptionsPageView overrides:
- virtual void InitControlLayout();
- virtual void InitContents(GridLayout* layout) = 0;
-
- 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:
- // The message id for the title of this section.
- int title_msg_id_;
-
- int single_column_view_set_id_;
- int double_column_view_set_id_;
-
- DISALLOW_COPY_AND_ASSIGN(SettingsPageSection);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_OPTIONS_SETTINGS_PAGE_VIEW_H_
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
deleted file mode 100644
index a77f422..0000000
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright (c) 2011 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/options/system_page_view.h"
-
-#include <string>
-#include <vector>
-
-#include "base/stl_util-inl.h"
-#include "base/string16.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/cros/keyboard_library.h"
-#include "chrome/browser/chromeos/cros/system_library.h"
-#include "chrome/browser/chromeos/language_preferences.h"
-#include "chrome/browser/chromeos/options/options_window_view.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/pref_names.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/models/combobox_model.h"
-#include "unicode/timezone.h"
-#include "views/controls/button/checkbox.h"
-#include "views/controls/button/native_button.h"
-#include "views/controls/combobox/combobox.h"
-#include "views/controls/slider/slider.h"
-#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// DateTimeSection
-
-// Date/Time section for datetime settings
-class DateTimeSection : public SettingsPageSection,
- public views::Combobox::Listener,
- public SystemLibrary::Observer {
- public:
- explicit DateTimeSection(Profile* profile);
- virtual ~DateTimeSection();
-
- // Overridden from views::Combobox::Listener:
- virtual void ItemChanged(views::Combobox* sender,
- int prev_index,
- int new_index);
-
- // Overridden from SystemLibrary::Observer:
- virtual void TimezoneChanged(const icu::TimeZone& timezone);
-
- protected:
- // SettingsPageSection overrides:
- virtual void InitContents(GridLayout* layout);
-
- private:
- // The combobox model for the list of timezones.
- class TimezoneComboboxModel : public ui::ComboboxModel {
- public:
- TimezoneComboboxModel() {
- // TODO(chocobo): 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.
- // NOTE: This currently does not handle daylight savings properly
- // b/c this is just a manually selected list of timezones that
- // happen to span the GMT-11 to GMT+12 Today. When daylight savings
- // kick in, this list might have more than one timezone in the same
- // GMT bucket.
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Pacific/Samoa")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("US/Hawaii")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("US/Alaska")));
- 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")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("America/Santiago")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("America/Sao_Paulo")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Atlantic/South_Georgia")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Atlantic/Cape_Verde")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Europe/London")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Europe/Rome")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Europe/Helsinki")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Europe/Moscow")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Dubai")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Karachi")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Dhaka")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Bangkok")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Hong_Kong")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Tokyo")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Australia/Sydney")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Asia/Magadan")));
- timezones_.push_back(icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8("Pacific/Auckland")));
- }
-
- virtual ~TimezoneComboboxModel() {
- STLDeleteElements(&timezones_);
- }
-
- virtual int GetItemCount() {
- return static_cast<int>(timezones_.size());
- }
-
- virtual string16 GetItemAt(int index) {
- icu::UnicodeString name;
- timezones_[index]->getDisplayName(name);
- std::wstring output;
- UTF16ToWide(name.getBuffer(), name.length(), &output);
- int hour_offset = timezones_[index]->getRawOffset() / 3600000;
- return WideToUTF16Hack(
- base::StringPrintf(hour_offset == 0 ? L"(GMT) " : (hour_offset > 0 ?
- L"(GMT+%d) " : L"(GMT%d) "), hour_offset) + output);
- }
-
- virtual icu::TimeZone* GetTimeZoneAt(int index) {
- return timezones_[index];
- }
-
- private:
- std::vector<icu::TimeZone*> timezones_;
-
- DISALLOW_COPY_AND_ASSIGN(TimezoneComboboxModel);
- };
-
- // TimeZone combobox model.
- views::Combobox* timezone_combobox_;
-
- // Controls for this section:
- TimezoneComboboxModel timezone_combobox_model_;
-
- DISALLOW_COPY_AND_ASSIGN(DateTimeSection);
-};
-
-DateTimeSection::DateTimeSection(Profile* profile)
- : SettingsPageSection(profile, IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME),
- timezone_combobox_(NULL) {
- CrosLibrary::Get()->GetSystemLibrary()->AddObserver(this);
-}
-
-DateTimeSection::~DateTimeSection() {
- CrosLibrary::Get()->GetSystemLibrary()->RemoveObserver(this);
-}
-
-void DateTimeSection::ItemChanged(views::Combobox* sender,
- int prev_index,
- int new_index) {
- if (new_index == prev_index)
- return;
-
- CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(
- timezone_combobox_model_.GetTimeZoneAt(new_index));
-}
-
-void DateTimeSection::TimezoneChanged(const icu::TimeZone& timezone) {
- for (int i = 0; i < timezone_combobox_model_.GetItemCount(); i++) {
- if (*timezone_combobox_model_.GetTimeZoneAt(i) == timezone) {
- timezone_combobox_->SetSelectedItem(i);
- return;
- }
- }
-}
-
-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(UTF16ToWide(
- l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION))));
- layout->AddView(timezone_combobox_);
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
-
- TimezoneChanged(CrosLibrary::Get()->GetSystemLibrary()->GetTimezone());
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// TouchpadSection
-
-class TouchpadSection : public SettingsPageSection,
- public views::ButtonListener,
- public views::SliderListener {
- public:
- explicit TouchpadSection(Profile* profile);
- virtual ~TouchpadSection() {}
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
-
- // Overridden from views::SliderListener:
- virtual void SliderValueChanged(views::Slider* sender);
-
- protected:
- // SettingsPageSection overrides:
- virtual void InitContents(GridLayout* layout);
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- private:
- // The View that contains the contents of the section.
- views::View* contents_;
-
- // Controls for this section:
- views::Checkbox* enable_tap_to_click_checkbox_;
- views::Slider* sensitivity_slider_;
-
- // Preferences for this section:
- BooleanPrefMember tap_to_click_enabled_;
- IntegerPrefMember sensitivity_;
-
- DISALLOW_COPY_AND_ASSIGN(TouchpadSection);
-};
-
-TouchpadSection::TouchpadSection(Profile* profile)
- : SettingsPageSection(profile, IDS_OPTIONS_SETTINGS_SECTION_TITLE_TOUCHPAD),
- enable_tap_to_click_checkbox_(NULL),
- sensitivity_slider_(NULL) {
-}
-
-void TouchpadSection::ButtonPressed(
- views::Button* sender, const views::Event& event) {
- if (sender == enable_tap_to_click_checkbox_) {
- bool enabled = enable_tap_to_click_checkbox_->checked();
- UserMetricsRecordAction(enabled ?
- UserMetricsAction("Options_TapToClickCheckbox_Enable") :
- UserMetricsAction("Options_TapToClickCheckbox_Disable"),
- profile()->GetPrefs());
- tap_to_click_enabled_.SetValue(enabled);
- }
-}
-
-void TouchpadSection::SliderValueChanged(views::Slider* sender) {
- if (sender == sensitivity_slider_) {
- double value = sensitivity_slider_->value();
- UserMetricsRecordAction(
- UserMetricsAction("Options_SensitivitySlider_Changed"),
- profile()->GetPrefs());
- sensitivity_.SetValue(value);
- }
-}
-
-void TouchpadSection::InitContents(GridLayout* layout) {
- enable_tap_to_click_checkbox_ =
- new views::Checkbox(UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_TAP_TO_CLICK_ENABLED_DESCRIPTION)));
- enable_tap_to_click_checkbox_->set_listener(this);
- enable_tap_to_click_checkbox_->SetMultiLine(true);
- // Create sensitivity slider with values between 1 and 5 step 1
- sensitivity_slider_ = new views::Slider(1, 5, 1,
- static_cast<views::Slider::StyleFlags>(
- views::Slider::STYLE_DRAW_VALUE |
- views::Slider::STYLE_UPDATE_ON_RELEASE),
- this);
-
- layout->StartRow(0, double_column_view_set_id());
- layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_SENSITIVITY_DESCRIPTION))));
- layout->AddView(sensitivity_slider_);
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
- layout->StartRow(0, single_column_view_set_id());
- layout->AddView(enable_tap_to_click_checkbox_);
- layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
-
- // Init member prefs so we can update the controls if prefs change.
- tap_to_click_enabled_.Init(prefs::kTapToClickEnabled,
- profile()->GetPrefs(), this);
- sensitivity_.Init(prefs::kTouchpadSensitivity,
- profile()->GetPrefs(), this);
-}
-
-void TouchpadSection::NotifyPrefChanged(const std::string* pref_name) {
- if (!pref_name || *pref_name == prefs::kTapToClickEnabled) {
- bool enabled = tap_to_click_enabled_.GetValue();
- enable_tap_to_click_checkbox_->SetChecked(enabled);
- }
- if (!pref_name || *pref_name == prefs::kTouchpadSensitivity) {
- double value = sensitivity_.GetValue();
- sensitivity_slider_->SetValue(value);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// AccessibilitySection
-
-// Checkbox for specifying if accessibility should be enabled for this profile
-class AccessibilitySection : public SettingsPageSection,
- public views::ButtonListener {
- public:
- explicit AccessibilitySection(Profile* profile);
- virtual ~AccessibilitySection() {}
-
- protected:
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender,
- const views::Event& event);
-
- // Overridden from SettingsPageSection:
- virtual void InitContents(GridLayout* layout);
- virtual void NotifyPrefChanged(const std::string* pref_name);
-
- private:
- // The View that contains the contents of the section.
- views::View* contents_;
-
- // Controls for this section:
- views::Checkbox* accessibility_checkbox_;
-
- // Preferences for this section:
- BooleanPrefMember accessibility_enabled_;
-
- DISALLOW_COPY_AND_ASSIGN(AccessibilitySection);
-};
-
-AccessibilitySection::AccessibilitySection(Profile* profile)
- : SettingsPageSection(profile,
- IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY),
- accessibility_checkbox_(NULL) {
-}
-
-void AccessibilitySection::InitContents(GridLayout* layout) {
- accessibility_checkbox_ =
- new views::Checkbox(UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)));
- accessibility_checkbox_->set_listener(this);
- accessibility_checkbox_->SetMultiLine(true);
-
- layout->StartRow(0, double_column_view_set_id());
- layout->AddView(accessibility_checkbox_);
- layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
-
- // Init member prefs so we can update the controls if prefs change.
- accessibility_enabled_.Init(prefs::kAccessibilityEnabled,
- profile()->GetPrefs(), this);
-}
-
-void AccessibilitySection::ButtonPressed(
- views::Button* sender, const views::Event& event) {
- if (sender == accessibility_checkbox_) {
- bool enabled = accessibility_checkbox_->checked();
- // Set the accessibility enabled value in profile/prefs
- accessibility_enabled_.SetValue(enabled);
- }
-}
-
-void AccessibilitySection::NotifyPrefChanged(const std::string* pref_name) {
- if (!pref_name || *pref_name == prefs::kAccessibilityEnabled) {
- bool enabled = accessibility_enabled_.GetValue();
- accessibility_checkbox_->SetChecked(enabled);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// SystemPageView
-
-////////////////////////////////////////////////////////////////////////////////
-// SystemPageView, SettingsPageView implementation:
-
-void SystemPageView::InitControlLayout() {
- GridLayout* layout = GridLayout::CreatePanel(this);
- SetLayoutManager(layout);
-
- int single_column_view_set_id = 0;
- ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id);
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
- 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 TouchpadSection(profile()));
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
- layout->StartRow(0, single_column_view_set_id);
- layout->AddView(new AccessibilitySection(profile()));
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/options/system_page_view.h b/chrome/browser/chromeos/options/system_page_view.h
deleted file mode 100644
index 933ff98..0000000
--- a/chrome/browser/chromeos/options/system_page_view.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2006-2008 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_OPTIONS_SYSTEM_PAGE_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_OPTIONS_SYSTEM_PAGE_VIEW_H_
-#pragma once
-
-#include "chrome/browser/chromeos/options/settings_page_view.h"
-
-namespace chromeos {
-
-// System settings page for Chrome OS
-class SystemPageView : public SettingsPageView {
- public:
- explicit SystemPageView(Profile* profile) : SettingsPageView(profile) {}
- virtual ~SystemPageView() {}
-
- protected:
- // SettingsPageView implementation:
- virtual void InitControlLayout();
-
- DISALLOW_COPY_AND_ASSIGN(SystemPageView);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_OPTIONS_SYSTEM_PAGE_VIEW_H_
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index 99be05a..5380a6a 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/gtk/browser_window_gtk.h"
#include "chrome/browser/ui/gtk/cairo_cached_surface.h"
#include "chrome/browser/ui/gtk/gtk_theme_provider.h"
#include "chrome/common/renderer_preferences.h"
@@ -38,15 +39,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/x/x11_util.h"
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/frame/browser_view.h"
-#include "chrome/browser/chromeos/native_dialog_window.h"
-#include "chrome/browser/chromeos/options/options_window_view.h"
-#include "views/window/window.h"
-#else
-#include "chrome/browser/ui/gtk/browser_window_gtk.h"
-#endif
-
using WebKit::WebDragOperationsMask;
using WebKit::WebDragOperation;
using WebKit::WebDragOperationNone;
@@ -143,28 +135,6 @@ gboolean PaintNoBackground(GtkWidget* widget,
return TRUE;
}
-#if defined(OS_CHROMEOS)
-
-TabContents* GetBrowserWindowSelectedTabContents(BrowserWindow* window) {
- chromeos::BrowserView* browser_view = static_cast<chromeos::BrowserView*>(
- window);
- return browser_view->GetSelectedTabContents();
-}
-
-GtkWidget* GetBrowserWindowFocusedWidget(BrowserWindow* window) {
- gfx::NativeView widget = gtk_window_get_focus(window->GetNativeHandle());
-
- if (widget == NULL) {
- chromeos::BrowserView* browser_view = static_cast<chromeos::BrowserView*>(
- window);
- widget = browser_view->saved_focused_widget();
- }
-
- return widget;
-}
-
-#else
-
TabContents* GetBrowserWindowSelectedTabContents(BrowserWindow* window) {
BrowserWindowGtk* browser_window = static_cast<BrowserWindowGtk*>(
window);
@@ -175,8 +145,6 @@ GtkWidget* GetBrowserWindowFocusedWidget(BrowserWindow* window) {
return gtk_window_get_focus(window->GetNativeHandle());
}
-#endif
-
} // namespace
namespace event_utils {
@@ -1004,83 +972,6 @@ void GetTextColors(GdkColor* normal_base,
g_object_unref(fake_entry);
}
-#if defined(OS_CHROMEOS)
-
-GtkWindow* GetDialogTransientParent(GtkWindow* dialog) {
- GtkWindow* parent = gtk_window_get_transient_for(dialog);
- if (!parent)
- parent = chromeos::GetOptionsViewParent();
-
- return parent;
-}
-
-void ShowDialog(GtkWidget* dialog) {
- // Make sure all controls are visible so that we get correct size.
- gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
-
- // Get dialog window size.
- gint width = 0;
- gint height = 0;
- gtk_window_get_size(GTK_WINDOW(dialog), &width, &height);
-
- chromeos::ShowNativeDialog(GetDialogTransientParent(GTK_WINDOW(dialog)),
- dialog,
- gtk_window_get_resizable(GTK_WINDOW(dialog)) ?
- chromeos::DIALOG_FLAG_RESIZEABLE :
- chromeos::DIALOG_FLAG_DEFAULT,
- gfx::Size(width, height),
- gfx::Size());
-}
-
-void ShowDialogWithLocalizedSize(GtkWidget* dialog,
- int width_id,
- int height_id,
- bool resizeable) {
- int width = (width_id == -1) ? 0 :
- views::Window::GetLocalizedContentsWidth(width_id);
- int height = (height_id == -1) ? 0 :
- views::Window::GetLocalizedContentsHeight(height_id);
-
- chromeos::ShowNativeDialog(GetDialogTransientParent(GTK_WINDOW(dialog)),
- dialog,
- resizeable ? chromeos::DIALOG_FLAG_RESIZEABLE :
- chromeos::DIALOG_FLAG_DEFAULT,
- gfx::Size(width, height),
- gfx::Size());
-}
-
-void ShowModalDialogWithMinLocalizedWidth(GtkWidget* dialog,
- int width_id) {
- int width = (width_id == -1) ? 0 :
- views::Window::GetLocalizedContentsWidth(width_id);
-
- chromeos::ShowNativeDialog(GetDialogTransientParent(GTK_WINDOW(dialog)),
- dialog,
- chromeos::DIALOG_FLAG_MODAL,
- gfx::Size(),
- gfx::Size(width, 0));
-}
-
-void PresentWindow(GtkWidget* window, int timestamp) {
- GtkWindow* host_window = chromeos::GetNativeDialogWindow(window);
- if (!host_window)
- host_window = GTK_WINDOW(window);
- if (timestamp)
- gtk_window_present_with_time(host_window, timestamp);
- else
- gtk_window_present(host_window);
-}
-
-GtkWindow* GetDialogWindow(GtkWidget* dialog) {
- return chromeos::GetNativeDialogWindow(dialog);
-}
-
-gfx::Rect GetDialogBounds(GtkWidget* dialog) {
- return chromeos::GetNativeDialogContentsBounds(dialog);
-}
-
-#else
-
void ShowDialog(GtkWidget* dialog) {
gtk_widget_show_all(dialog);
}
@@ -1129,8 +1020,6 @@ gfx::Rect GetDialogBounds(GtkWidget* dialog) {
return gfx::Rect(x, y, width, height);
}
-#endif
-
string16 GetStockPreferencesMenuLabel() {
GtkStockItem stock_item;
string16 preferences;
diff --git a/chrome/browser/ui/gtk/options/content_page_gtk.cc b/chrome/browser/ui/gtk/options/content_page_gtk.cc
index c29f530..9ba3d5a 100644
--- a/chrome/browser/ui/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/ui/gtk/options/content_page_gtk.cc
@@ -31,10 +31,6 @@
#include "grit/locale_settings.h"
#include "ui/base/l10n/l10n_util.h"
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/options/options_window_view.h"
-#endif // defined(OS_CHROMEOS)
-
namespace {
// Background color for the status label when it's showing an error.
@@ -70,10 +66,8 @@ ContentPageGtk::ContentPageGtk(Profile* profile)
: OptionsPageBase(profile),
sync_status_label_background_(NULL),
sync_status_label_(NULL),
-#if !defined(OS_CHROMEOS)
sync_action_link_background_(NULL),
sync_action_link_(NULL),
-#endif
sync_start_stop_button_(NULL),
sync_customize_button_(NULL),
privacy_dashboard_link_(NULL),
@@ -341,7 +335,6 @@ GtkWidget* ContentPageGtk::InitSyncGroup() {
gtk_container_add(GTK_CONTAINER(sync_status_label_background_),
sync_status_label_);
-#if !defined(OS_CHROMEOS)
// Sync action link.
GtkWidget* link_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing);
sync_action_link_background_ = gtk_event_box_new();
@@ -354,7 +347,6 @@ GtkWidget* ContentPageGtk::InitSyncGroup() {
gtk_container_add(GTK_CONTAINER(sync_action_link_background_),
sync_action_link_);
gtk_widget_hide(sync_action_link_background_);
-#endif
// Add the sync button into its own horizontal box so it does not
// depend on the spacing above.
@@ -404,34 +396,22 @@ void ContentPageGtk::UpdateSyncControls() {
l10n_util::GetStringUTF8(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL);
std::string start_stop_button_label;
- bool is_start_stop_button_visible = false;
bool is_start_stop_button_sensitive = false;
if (sync_setup_completed) {
start_stop_button_label =
l10n_util::GetStringUTF8(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
-#if defined(OS_CHROMEOS)
- is_start_stop_button_visible = false;
-#else
- is_start_stop_button_visible = true;
-#endif
is_start_stop_button_sensitive = !managed;
} else if (sync_service_->SetupInProgress()) {
start_stop_button_label =
l10n_util::GetStringUTF8(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
- is_start_stop_button_visible = true;
is_start_stop_button_sensitive = false;
} else {
start_stop_button_label =
l10n_util::GetStringUTF8(IDS_SYNC_START_SYNC_BUTTON_LABEL);
- is_start_stop_button_visible = true;
is_start_stop_button_sensitive = !managed;
}
- gtk_widget_set_no_show_all(sync_start_stop_button_,
- !is_start_stop_button_visible);
- if (is_start_stop_button_visible)
- gtk_widget_show(sync_start_stop_button_);
- else
- gtk_widget_hide(sync_start_stop_button_);
+ gtk_widget_set_no_show_all(sync_start_stop_button_, FALSE);
+ gtk_widget_show(sync_start_stop_button_);
gtk_widget_set_sensitive(sync_start_stop_button_,
is_start_stop_button_sensitive);
gtk_button_set_label(GTK_BUTTON(sync_start_stop_button_),
@@ -445,7 +425,6 @@ void ContentPageGtk::UpdateSyncControls() {
gtk_button_set_label(GTK_BUTTON(sync_customize_button_),
customize_button_label.c_str());
gtk_widget_set_sensitive(sync_customize_button_, !managed);
-#if !defined(OS_CHROMEOS)
gtk_chrome_link_button_set_label(GTK_CHROME_LINK_BUTTON(sync_action_link_),
UTF16ToUTF8(link_label).c_str());
if (link_label.empty()) {
@@ -456,19 +435,14 @@ void ContentPageGtk::UpdateSyncControls() {
gtk_widget_show(sync_action_link_background_);
}
gtk_widget_set_sensitive(sync_action_link_, !managed);
-#endif
if (status_has_error) {
gtk_widget_modify_bg(sync_status_label_background_, GTK_STATE_NORMAL,
&kSyncLabelErrorBgColor);
-#if !defined(OS_CHROMEOS)
gtk_widget_modify_bg(sync_action_link_background_, GTK_STATE_NORMAL,
&kSyncLabelErrorBgColor);
-#endif
} else {
gtk_widget_modify_bg(sync_status_label_background_, GTK_STATE_NORMAL, NULL);
-#if !defined(OS_CHROMEOS)
gtk_widget_modify_bg(sync_action_link_background_, GTK_STATE_NORMAL, NULL);
-#endif
}
}
@@ -497,12 +471,6 @@ void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkWidget* widget) {
void ContentPageGtk::OnGetThemesButtonClicked(GtkWidget* widget) {
UserMetricsRecordAction(UserMetricsAction("Options_ThemesGallery"),
profile()->GetPrefs());
-#if defined(OS_CHROMEOS)
- // Close options dialog for ChromeOS becuase it is always stacked on top
- // of browser window and blocks user's view.
- chromeos::CloseOptionsWindow();
-#endif // defined(OS_CHROMEOS)
-
BrowserList::GetLastActive()->OpenThemeGalleryTabAndActivate();
}
diff --git a/chrome/browser/ui/gtk/options/options_window_gtk.cc b/chrome/browser/ui/gtk/options/options_window_gtk.cc
index ecc8ab3..32fea06 100644
--- a/chrome/browser/ui/gtk/options/options_window_gtk.cc
+++ b/chrome/browser/ui/gtk/options/options_window_gtk.cc
@@ -25,11 +25,6 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/options/internet_page_view.h"
-#include "chrome/browser/chromeos/options/system_page_view.h"
-#endif
-
///////////////////////////////////////////////////////////////////////////////
// OptionsWindowGtk
//
@@ -120,20 +115,6 @@ OptionsWindowGtk::OptionsWindowGtk(Profile* profile)
notebook_ = gtk_notebook_new();
-#if defined(OS_CHROMEOS)
- gtk_notebook_append_page(
- GTK_NOTEBOOK(notebook_),
- (new chromeos::SystemPageView(profile_))->WrapInGtkWidget(),
- gtk_label_new(
- l10n_util::GetStringUTF8(IDS_OPTIONS_SYSTEM_TAB_LABEL).c_str()));
-
- gtk_notebook_append_page(
- GTK_NOTEBOOK(notebook_),
- (new chromeos::InternetPageView(profile_))->WrapInGtkWidget(),
- gtk_label_new(
- l10n_util::GetStringUTF8(IDS_OPTIONS_INTERNET_TAB_LABEL).c_str()));
-#endif
-
gtk_notebook_append_page(
GTK_NOTEBOOK(notebook_),
general_page_.get_page_widget(),
@@ -240,9 +221,6 @@ void OptionsWindowGtk::OnWindowDestroy(GtkWidget* widget,
///////////////////////////////////////////////////////////////////////////////
// Factory/finder method:
-#if !defined(OS_CHROMEOS)
-// ShowOptionsWindow for non ChromeOS build. For ChromeOS build, see
-// chrome/browser/chromeos/options/options_window_view.h
void ShowOptionsWindow(OptionsPage page,
OptionsGroup highlight_group,
Profile* profile) {
@@ -264,4 +242,3 @@ void ShowOptionsWindow(OptionsPage page,
}
options_window->ShowOptionsPage(page, highlight_group);
}
-#endif // !defined(OS_CHROMEOS)
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f563a88..7f5e080 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -709,16 +709,8 @@
'browser/chromeos/offline/offline_load_page.h',
'browser/chromeos/offline/offline_load_service.cc',
'browser/chromeos/offline/offline_load_service.h',
- 'browser/chromeos/options/internet_page_view.cc',
- 'browser/chromeos/options/internet_page_view.h',
'browser/chromeos/options/network_config_view.cc',
'browser/chromeos/options/network_config_view.h',
- 'browser/chromeos/options/options_window_view.cc',
- 'browser/chromeos/options/options_window_view.h',
- 'browser/chromeos/options/settings_page_view.cc',
- 'browser/chromeos/options/settings_page_view.h',
- 'browser/chromeos/options/system_page_view.cc',
- 'browser/chromeos/options/system_page_view.h',
'browser/chromeos/options/wifi_config_view.cc',
'browser/chromeos/options/wifi_config_view.h',
'browser/chromeos/panels/panel_scroller.cc',