Commit d6835980 authored by yzshen@chromium.org's avatar yzshen@chromium.org

Revert 124433 - Adding persistance for gesture recognition parms.

Observer updates GestureRecognition parameters when settings change.

BUG=114015


Review URL: http://codereview.chromium.org/9460001

TBR=girard@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9562013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124436 0039d316-1c4b-4281-b951-d872f2087c98
parent 836c8975
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include "chrome/browser/ui/alternate_error_tab_observer.h" #include "chrome/browser/ui/alternate_error_tab_observer.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_init.h" #include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/gesture_prefs.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "chrome/browser/ui/search_engines/keyword_editor_controller.h" #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
#include "chrome/browser/ui/webui/flags_ui.h" #include "chrome/browser/ui/webui/flags_ui.h"
...@@ -161,8 +160,6 @@ void RegisterLocalState(PrefService* local_state) { ...@@ -161,8 +160,6 @@ void RegisterLocalState(PrefService* local_state) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
confirm_quit::RegisterLocalState(local_state); confirm_quit::RegisterLocalState(local_state);
#endif #endif
GesturePrefsRegisterPrefs(local_state);
} }
void RegisterUserPrefs(PrefService* user_prefs) { void RegisterUserPrefs(PrefService* user_prefs) {
......
// Copyright (c) 2012 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/ui/gesture_prefs.h"
void GesturePrefsRegisterPrefs(PrefService* prefs) {
}
// Copyright (c) 2012 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_UI_GESTURE_PREFS_H_
#define CHROME_BROWSER_UI_GESTURE_PREFS_H_
#pragma once
#include "base/compiler_specific.h"
class PrefService;
void GesturePrefsRegisterPrefs(PrefService* prefs);
#endif // CHROME_BROWSER_UI_GESTURE_PREFS_H_
// Copyright (c) 2012 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/memory/singleton.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/gesture_prefs.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_observer.h"
#include "ui/aura/gestures/gesture_configuration.h"
namespace {
// This class manages gesture configuration preferences.
class GesturePrefsObserverAura : public content::NotificationObserver {
public:
static GesturePrefsObserverAura *GetInstance();
void RegisterPrefs(PrefService* prefs);
private:
GesturePrefsObserverAura();
friend struct DefaultSingletonTraits<GesturePrefsObserverAura>;
virtual ~GesturePrefsObserverAura();
// content::NotificationObserver implementation.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
void Update();
PrefChangeRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(GesturePrefsObserverAura);
};
GesturePrefsObserverAura::GesturePrefsObserverAura() {
}
GesturePrefsObserverAura::~GesturePrefsObserverAura() {
}
GesturePrefsObserverAura* GesturePrefsObserverAura::GetInstance() {
return Singleton<GesturePrefsObserverAura>::get();
}
// The list of prefs we want to observe.
// Note that this collection of settings should correspond to the settings used
// in ui/aura/gestures/gesture_configuration.h
const char* kPrefsToObserve[] = {
prefs::kMaximumSecondsBetweenDoubleClick,
prefs::kMaximumTouchDownDurationInSecondsForClick,
prefs::kMaximumTouchMoveInPixelsForClick,
prefs::kMinFlickSpeedSquared,
prefs::kMinimumTouchDownDurationInSecondsForClick,
};
const int kPrefsToObserveLength = arraysize(kPrefsToObserve);
void GesturePrefsObserverAura::RegisterPrefs(PrefService* ) {
PrefService* local_state = g_browser_process->local_state();
local_state->RegisterDoublePref(
prefs::kMaximumSecondsBetweenDoubleClick, 0.7);
local_state->RegisterDoublePref(
prefs::kMaximumTouchDownDurationInSecondsForClick, 0.8);
local_state->RegisterDoublePref(
prefs::kMaximumTouchMoveInPixelsForClick, 20);
local_state->RegisterDoublePref(
prefs::kMinFlickSpeedSquared, 550.f*550.f);
local_state->RegisterDoublePref(
prefs::kMinimumTouchDownDurationInSecondsForClick, 0.01);
registrar_.Init(local_state);
if (local_state) {
for (int i = 0; i < kPrefsToObserveLength; ++i)
registrar_.Add(kPrefsToObserve[i], this);
}
}
void GesturePrefsObserverAura::Update() {
PrefService* local_state = g_browser_process->local_state();
aura::GestureConfiguration::set_max_seconds_between_double_click(
local_state->GetDouble(prefs::kMaximumSecondsBetweenDoubleClick));
aura::GestureConfiguration::set_max_touch_down_duration_in_seconds_for_click(
local_state->GetDouble(prefs::kMaximumTouchDownDurationInSecondsForClick));
aura::GestureConfiguration::set_max_touch_move_in_pixels_for_click(
local_state->GetDouble(prefs::kMaximumTouchMoveInPixelsForClick));
aura::GestureConfiguration::set_min_flick_speed_squared(
local_state->GetDouble(prefs::kMinFlickSpeedSquared));
aura::GestureConfiguration::set_min_touch_down_duration_in_seconds_for_click(
local_state->GetDouble(prefs::kMinimumTouchDownDurationInSecondsForClick));
}
void GesturePrefsObserverAura::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
Update();
}
} // namespace
void GesturePrefsRegisterPrefs(PrefService* prefs) {
GesturePrefsObserverAura::GetInstance()->RegisterPrefs(prefs);
}
...@@ -3131,8 +3131,6 @@ ...@@ -3131,8 +3131,6 @@
'browser/ui/fullscreen_exit_bubble.h', 'browser/ui/fullscreen_exit_bubble.h',
'browser/ui/fullscreen_exit_bubble_type.cc', 'browser/ui/fullscreen_exit_bubble_type.cc',
'browser/ui/fullscreen_exit_bubble_type.h', 'browser/ui/fullscreen_exit_bubble_type.h',
'browser/ui/gesture_prefs.cc',
'browser/ui/gesture_prefs.h',
'browser/ui/global_error.cc', 'browser/ui/global_error.cc',
'browser/ui/global_error.h', 'browser/ui/global_error.h',
'browser/ui/global_error_bubble_view_base.h', 'browser/ui/global_error_bubble_view_base.h',
...@@ -3535,7 +3533,6 @@ ...@@ -3535,7 +3533,6 @@
'browser/ui/views/aura/caps_lock_handler.h', 'browser/ui/views/aura/caps_lock_handler.h',
'browser/ui/views/aura/chrome_shell_delegate.cc', 'browser/ui/views/aura/chrome_shell_delegate.cc',
'browser/ui/views/aura/chrome_shell_delegate.h', 'browser/ui/views/aura/chrome_shell_delegate.h',
'browser/ui/views/aura/gesture_prefs_aura.cc',
'browser/ui/views/aura/ime_controller_chromeos.cc', 'browser/ui/views/aura/ime_controller_chromeos.cc',
'browser/ui/views/aura/ime_controller_chromeos.h', 'browser/ui/views/aura/ime_controller_chromeos.h',
'browser/ui/views/aura/launcher/chrome_launcher_delegate.cc', 'browser/ui/views/aura/launcher/chrome_launcher_delegate.cc',
...@@ -4568,8 +4565,6 @@ ...@@ -4568,8 +4565,6 @@
['exclude', '^browser/renderer_host/render_widget_host_view_views*'], ['exclude', '^browser/renderer_host/render_widget_host_view_views*'],
['exclude', '^browser/tab_contents/web_drag_source_win.cc'], ['exclude', '^browser/tab_contents/web_drag_source_win.cc'],
['exclude', '^browser/tab_contents/web_drag_source_win.h'], ['exclude', '^browser/tab_contents/web_drag_source_win.h'],
['exclude', '^browser/ui/gesture_prefs.cc'],
['exclude', '^browser/ui/input_window_dialog_linux.cc'],
['exclude', '^browser/ui/panels/auto_hiding_desktop_bar_win.cc'], ['exclude', '^browser/ui/panels/auto_hiding_desktop_bar_win.cc'],
['exclude', '^browser/ui/tabs/dock_info_win.cc'], ['exclude', '^browser/ui/tabs/dock_info_win.cc'],
['exclude', '^browser/ui/views/about_ipc_dialog.cc'], ['exclude', '^browser/ui/views/about_ipc_dialog.cc'],
...@@ -4612,7 +4607,6 @@ ...@@ -4612,7 +4607,6 @@
['include', '^browser/chromeos/status/status_area_button.h'], ['include', '^browser/chromeos/status/status_area_button.h'],
['include', '^browser/chromeos/status/status_area_view.cc'], ['include', '^browser/chromeos/status/status_area_view.cc'],
['include', '^browser/chromeos/status/status_area_view.h'], ['include', '^browser/chromeos/status/status_area_view.h'],
['include', '^browser/ui/views/aura/gesture_prefs_aura.cc'],
['include', '^browser/ui/views/simple_message_box_views.cc'], ['include', '^browser/ui/views/simple_message_box_views.cc'],
['include', '^browser/ui/views/simple_message_box_views.h'], ['include', '^browser/ui/views/simple_message_box_views.h'],
['include', '^browser/ui/webui/certificate_viewer_webui.cc'], ['include', '^browser/ui/webui/certificate_viewer_webui.cc'],
......
...@@ -1772,17 +1772,6 @@ const char kWebIntentsEnabled[] = "webintents.enabled"; ...@@ -1772,17 +1772,6 @@ const char kWebIntentsEnabled[] = "webintents.enabled";
#if defined(USE_AURA) #if defined(USE_AURA)
const char kPinnedLauncherApps[] = "pinned_launcher_apps"; const char kPinnedLauncherApps[] = "pinned_launcher_apps";
const char kMaximumSecondsBetweenDoubleClick[] =
"gesture.maximum_seconds_between_double_click";
const char kMaximumTouchDownDurationInSecondsForClick[] =
"gesture.maximum_touch_down_duration_in_seconds_for_click";
const char kMaximumTouchMoveInPixelsForClick[] =
"gesture.maximum_touch_move_in_pixels_for_click";
const char kMinFlickSpeedSquared[] =
"gesture.min_flick_speed_squared";
const char kMinimumTouchDownDurationInSecondsForClick[] =
"gesture.minimum_touch_down_duration_in_seconds_for_click";
#endif #endif
// Indicates whether the browser is in managed mode. // Indicates whether the browser is in managed mode.
......
...@@ -663,12 +663,6 @@ extern const char kWebIntentsEnabled[]; ...@@ -663,12 +663,6 @@ extern const char kWebIntentsEnabled[];
#if defined(USE_AURA) #if defined(USE_AURA)
extern const char kPinnedLauncherApps[]; extern const char kPinnedLauncherApps[];
extern const char kMaximumSecondsBetweenDoubleClick[];
extern const char kMaximumTouchDownDurationInSecondsForClick[];
extern const char kMaximumTouchMoveInPixelsForClick[];
extern const char kMinFlickSpeedSquared[];
extern const char kMinimumTouchDownDurationInSecondsForClick[];
#endif #endif
extern const char kInManagedMode[]; extern const char kInManagedMode[];
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#pragma once #pragma once
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ui/aura/aura_export.h"
namespace aura { namespace aura {
...@@ -15,7 +14,7 @@ namespace aura { ...@@ -15,7 +14,7 @@ namespace aura {
// approaches (windows, chrome, others). This would turn into an // approaches (windows, chrome, others). This would turn into an
// abstract base class. // abstract base class.
class AURA_EXPORT GestureConfiguration { class GestureConfiguration {
public: public:
static double max_touch_down_duration_in_seconds_for_click() { static double max_touch_down_duration_in_seconds_for_click() {
return max_touch_down_duration_in_seconds_for_click_; return max_touch_down_duration_in_seconds_for_click_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment