summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 20:21:53 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 20:21:53 +0000
commit2627431bef905332e55a90960aed8049b681689f (patch)
tree4d15c42eb95a48241e2bc9a109bbb77c3eafad00
parentd328413b739ed1150369743a64cacfb167086a32 (diff)
downloadchromium_src-2627431bef905332e55a90960aed8049b681689f.zip
chromium_src-2627431bef905332e55a90960aed8049b681689f.tar.gz
chromium_src-2627431bef905332e55a90960aed8049b681689f.tar.bz2
Lands http://codereview.chromium.org/193032 for Charlie:
First pass at adding ChromeOS settings - a mock wifi selector combobox - touchpad settings that makes calls to synclient - on startup, touchpad settings are initialized to what's stored in preferences TEST=none BUG=none Review URL: http://codereview.chromium.org/203073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26259 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd19
-rw-r--r--chrome/browser/chromeos/settings_page_view.cc7
-rw-r--r--chrome/browser/chromeos/settings_page_view.h7
-rw-r--r--chrome/browser/options_util.cc4
-rw-r--r--chrome/browser/profile.cc14
-rw-r--r--chrome/browser/profile.h8
-rw-r--r--chrome/chrome.gyp8
-rw-r--r--chrome/common/pref_names.cc10
-rw-r--r--chrome/common/pref_names.h4
-rw-r--r--skia/ext/skia_utils_gtk.cc7
-rw-r--r--views/controls/native_control_gtk.cc4
-rw-r--r--views/focus/focus_manager_gtk.cc6
-rw-r--r--views/window/dialog_client_view.cc23
13 files changed, 101 insertions, 20 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index fe464c4..bb6ed9e 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5031,6 +5031,25 @@ Keep your key file in a safe place. You will need it to create new versions of y
</message>
</if>
+ <!-- Chrome OS Strings -->
+ <if expr="pp_ifdef('chromeos')">
+ <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_NETWORK">
+ Network
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_TOUCHPAD">
+ Touchpad
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_PASSWORD">
+ Network Password
+ </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>
+ <message name="IDS_OPTIONS_SETTINGS_VERT_EDGE_SCROLL_ENABLED_DESCRIPTION" desc="In the settings tab, the text next to the checkbox that enables vertical edge scrolling.">
+ Enable vertical edge scrolling
+ </message>
+ </if>
+
</messages>
</release>
</grit>
diff --git a/chrome/browser/chromeos/settings_page_view.cc b/chrome/browser/chromeos/settings_page_view.cc
index bfbb46f..9c19c34 100644
--- a/chrome/browser/chromeos/settings_page_view.cc
+++ b/chrome/browser/chromeos/settings_page_view.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/settings_page_view.h"
+#include "chrome/browser/chromeos/settings_contents_view.h"
#include "views/controls/label.h"
#include "views/fill_layout.h"
#include "views/widget/widget_gtk.h"
@@ -29,7 +30,7 @@ GtkWidget* SettingsPageView::WrapInGtkWidget() {
}
void SettingsPageView::InitControlLayout() {
- // Remove this and add the real views we want. We'll likely need to make this
- // scrollable as well.
- AddChildView(new views::Label(L"Implement me"));
+ // We'll likely need to make this scrollable
+ settings_contents_view_ = new SettingsContentsView(profile());
+ AddChildView(settings_contents_view_);
}
diff --git a/chrome/browser/chromeos/settings_page_view.h b/chrome/browser/chromeos/settings_page_view.h
index b512fea..3d7004d 100644
--- a/chrome/browser/chromeos/settings_page_view.h
+++ b/chrome/browser/chromeos/settings_page_view.h
@@ -5,9 +5,11 @@
#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_PAGE_VIEW_H_
#define CHROME_BROWSER_CHROMEOS_SETTINGS_PAGE_VIEW_H_
+#include <gtk/gtk.h>
+
#include "chrome/browser/views/options/options_page_view.h"
-#include <gtk/gtk.h>
+class SettingsContentsView;
// Settings page for Chrome OS.
class SettingsPageView : public OptionsPageView {
@@ -23,6 +25,9 @@ class SettingsPageView : public OptionsPageView {
virtual void InitControlLayout();
private:
+ // Controls for the Settings page
+ SettingsContentsView* settings_contents_view_;
+
DISALLOW_COPY_AND_ASSIGN(SettingsPageView);
};
diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc
index fe985de..fe588cb 100644
--- a/chrome/browser/options_util.cc
+++ b/chrome/browser/options_util.cc
@@ -30,6 +30,10 @@ void OptionsUtil::ResetToDefaults(Profile* profile) {
prefs::kSSL3Enabled,
prefs::kTLS1Enabled,
#endif
+#if defined(OS_CHROMEOS)
+ prefs::kTapToClickEnabled,
+ prefs::kVertEdgeScrollEnabled,
+#endif
prefs::kDownloadDefaultDirectory,
prefs::kDownloadExtensionsToOpen,
prefs::kEnableSpellCheck,
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index de7f949..85b809b 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -57,6 +57,10 @@
#include "chrome/browser/gtk/gtk_theme_provider.h"
#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/touchpad.h"
+#endif
+
using base::Time;
using base::TimeDelta;
@@ -597,6 +601,10 @@ ProfileImpl::ProfileImpl(const FilePath& path)
ssl_config_service_manager_.reset(
SSLConfigServiceManager::CreateDefaultManager(this));
+
+#if defined(OS_CHROMEOS)
+ touchpad_.Init(prefs);
+#endif
}
void ProfileImpl::InitExtensions() {
@@ -849,6 +857,12 @@ PrefService* ProfileImpl::GetPrefs() {
// register known prefs as soon as possible.
Profile::RegisterUserPrefs(prefs_.get());
ProfileManager::RegisterUserPrefs(prefs_.get());
+#if defined(OS_CHROMEOS)
+ // 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());
+#endif
// The last session exited cleanly if there is no pref for
// kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h
index 1769ec8..ba4dd87 100644
--- a/chrome/browser/profile.h
+++ b/chrome/browser/profile.h
@@ -18,6 +18,10 @@
#include "chrome/browser/web_resource/web_resource_service.h"
#include "chrome/common/notification_registrar.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/touchpad.h"
+#endif
+
namespace net {
class StrictTransportSecurityState;
class SSLConfigService;
@@ -521,6 +525,10 @@ class ProfileImpl : public Profile,
// GetSessionService won't recreate the SessionService.
bool shutdown_session_service_;
+#if defined(OS_CHROMEOS)
+ Touchpad touchpad_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(ProfileImpl);
};
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index c45a581..bf939fb 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -861,12 +861,16 @@
'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/gview_request_interceptor.cc',
+ 'browser/chromeos/gview_request_interceptor.h',
+ 'browser/chromeos/settings_contents_view.cc',
+ 'browser/chromeos/settings_contents_view.h',
'browser/chromeos/settings_page_view.cc',
'browser/chromeos/settings_page_view.h',
'browser/chromeos/status_area_view.cc',
'browser/chromeos/status_area_view.h',
+ 'browser/chromeos/touchpad.cc',
+ 'browser/chromeos/touchpad.h',
'browser/cocoa/about_window_controller.h',
'browser/cocoa/about_window_controller.mm',
'browser/cocoa/autocomplete_text_field.h',
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 4294aaa..4ee3cb7 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -203,6 +203,16 @@ extern const wchar_t kSSL3Enabled[] = L"ssl.ssl3.enabled";
extern const wchar_t kTLS1Enabled[] = L"ssl.tls1.enabled";
#endif
+#if defined(OS_CHROMEOS)
+// 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";
+
+// A boolean pref set to true if VertEdgeScroll is being done in browser.
+extern const wchar_t kVertEdgeScrollEnabled[] =
+ L"settings.touchpad.enable_vert_edge_scroll";
+#endif
+
// The disabled messages in IPC logging.
const wchar_t kIpcDisabledMessages[] = L"ipc_log_disabled_messages";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 80f34d5..18c7d45 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -71,6 +71,10 @@ extern const wchar_t kSSL2Enabled[];
extern const wchar_t kSSL3Enabled[];
extern const wchar_t kTLS1Enabled[];
#endif
+#if defined(OS_CHROMEOS)
+extern const wchar_t kTapToClickEnabled[];
+extern const wchar_t kVertEdgeScrollEnabled[];
+#endif
extern const wchar_t kIpcDisabledMessages[];
extern const wchar_t kShowHomeButton[];
extern const wchar_t kShowPageOptionsButtons[];
diff --git a/skia/ext/skia_utils_gtk.cc b/skia/ext/skia_utils_gtk.cc
index 7989019..da56374 100644
--- a/skia/ext/skia_utils_gtk.cc
+++ b/skia/ext/skia_utils_gtk.cc
@@ -10,8 +10,13 @@ namespace skia {
const int kSkiaToGDKMultiplier = 257;
+// GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly
+// See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html
+// To get back, we can just right shift by eight
+// (or, formulated differently, i == (i*257)/256 for all i < 256).
+
SkColor GdkColorToSkColor(GdkColor color) {
- return SkColorSetRGB(color.red, color.green, color.blue);
+ return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8);
}
GdkColor SkColorToGdkColor(SkColor color) {
diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc
index 8de383f..d69ae758 100644
--- a/views/controls/native_control_gtk.cc
+++ b/views/controls/native_control_gtk.cc
@@ -76,7 +76,9 @@ void NativeControlGtk::CallFocusIn(GtkWidget* widget,
FocusManager* focus_manager =
FocusManager::GetFocusManagerForNativeView(widget);
if (!focus_manager) {
- NOTREACHED();
+ // TODO(jcampan): http://crbug.com/21378 Reenable this NOTREACHED() when the
+ // options page is only based on views.
+ // NOTREACHED();
return;
}
focus_manager->SetFocusedView(control->focus_view());
diff --git a/views/focus/focus_manager_gtk.cc b/views/focus/focus_manager_gtk.cc
index 6ba1390..5372bf4 100644
--- a/views/focus/focus_manager_gtk.cc
+++ b/views/focus/focus_manager_gtk.cc
@@ -20,7 +20,7 @@ void FocusManager::FocusNativeView(gfx::NativeView native_view) {
gtk_widget_grab_focus(native_view);
}
- // static
+// static
FocusManager* FocusManager::GetFocusManagerForNativeView(
gfx::NativeView native_view) {
GtkWidget* root = gtk_widget_get_toplevel(native_view);
@@ -29,7 +29,9 @@ FocusManager* FocusManager::GetFocusManagerForNativeView(
WidgetGtk* widget = WidgetGtk::GetViewForNative(root);
if (!widget) {
- NOTREACHED();
+ // TODO(jcampan): http://crbug.com/21378 Reenable this NOTREACHED() when the
+ // options page is only based on views.
+ // NOTREACHED();
return NULL;
}
FocusManager* focus_manager = widget->GetFocusManager();
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index 98482a0..5261679 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -4,26 +4,30 @@
#include "views/window/dialog_client_view.h"
+#if defined(OS_WIN)
+#include <windows.h>
+#include <uxtheme.h>
+#include <vsstyle.h>
+#else
+#include <gtk/gtk.h>
+#endif
+
+#include <algorithm>
+
#include "app/gfx/canvas.h"
#include "app/gfx/font.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/keyboard_codes.h"
#include "grit/app_strings.h"
+#include "skia/ext/skia_utils_gtk.h"
#include "views/controls/button/native_button.h"
#include "views/standard_layout.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
-
#if defined(OS_WIN)
-#include <windows.h>
-#include <uxtheme.h>
-#include <vsstyle.h>
-
#include "base/gfx/native_theme.h"
#else
-#include <gtk/gtk.h>
-
#include "views/window/hit_test.h"
#include "views/widget/widget.h"
#endif
@@ -274,9 +278,8 @@ void DialogClientView::Paint(gfx::Canvas* canvas) {
GtkWidget* widget = GetWidget()->GetNativeView();
if (GTK_IS_WINDOW(widget)) {
GtkStyle* window_style = gtk_widget_get_style(widget);
- canvas->FillRectInt(SkColorSetRGB(window_style->bg[GTK_STATE_NORMAL].red,
- window_style->bg[GTK_STATE_NORMAL].green,
- window_style->bg[GTK_STATE_NORMAL].blue),
+ canvas->FillRectInt(skia::GdkColorToSkColor(
+ window_style->bg[GTK_STATE_NORMAL]),
0, 0, width(), height());
}
#endif