Commit 2df98ab4 authored by mohsen's avatar mohsen Committed by Commit bot

Rename old Aura TouchSelectionController

Renamed old Aura TouchSelectionController in ui/base to
TouchEditingControllerDeprecated and also the corresponding factory
class to TouchEditingControllerFactory. In addition to preventing name
conflict with the new unified TouchSelectionController, the names match
better with the file name (touch_editing_controller).

BUG=399721

Review URL: https://codereview.chromium.org/798683003

Cr-Commit-Position: refs/heads/master@{#308154}
parent 2bab6931
...@@ -79,7 +79,7 @@ void TouchEditableImplAura::StartTouchEditing() { ...@@ -79,7 +79,7 @@ void TouchEditableImplAura::StartTouchEditing() {
if (!touch_selection_controller_) { if (!touch_selection_controller_) {
touch_selection_controller_.reset( touch_selection_controller_.reset(
ui::TouchSelectionController::create(this)); ui::TouchEditingControllerDeprecated::Create(this));
} }
if (touch_selection_controller_) if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged(); touch_selection_controller_->SelectionChanged();
......
...@@ -90,7 +90,7 @@ class CONTENT_EXPORT TouchEditableImplAura ...@@ -90,7 +90,7 @@ class CONTENT_EXPORT TouchEditableImplAura
ui::TextInputType text_input_type_; ui::TextInputType text_input_type_;
RenderWidgetHostViewAura* rwhva_; RenderWidgetHostViewAura* rwhva_;
scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; scoped_ptr<ui::TouchEditingControllerDeprecated> touch_selection_controller_;
// True if |rwhva_| is currently handling a gesture that could result in a // True if |rwhva_| is currently handling a gesture that could result in a
// change in selection (long press, double tap or triple tap). // change in selection (long press, double tap or triple tap).
......
...@@ -152,7 +152,7 @@ class TouchEditableImplAuraTest : public ContentBrowserTest { ...@@ -152,7 +152,7 @@ class TouchEditableImplAuraTest : public ContentBrowserTest {
return touch_editable->rwhva_; return touch_editable->rwhva_;
} }
ui::TouchSelectionController* GetTouchSelectionController( ui::TouchEditingControllerDeprecated* GetTouchSelectionController(
TouchEditableImplAura* touch_editable) { TouchEditableImplAura* touch_editable) {
return touch_editable->touch_selection_controller_.get(); return touch_editable->touch_selection_controller_.get();
} }
......
...@@ -7,19 +7,19 @@ ...@@ -7,19 +7,19 @@
namespace ui { namespace ui {
namespace { namespace {
TouchSelectionControllerFactory* g_shared_instance = NULL; TouchEditingControllerFactory* g_shared_instance = NULL;
} // namespace } // namespace
TouchSelectionController* TouchSelectionController::create( TouchEditingControllerDeprecated* TouchEditingControllerDeprecated::Create(
TouchEditable* client_view) { TouchEditable* client_view) {
if (g_shared_instance) if (g_shared_instance)
return g_shared_instance->create(client_view); return g_shared_instance->Create(client_view);
return NULL; return NULL;
} }
// static // static
void TouchSelectionControllerFactory::SetInstance( void TouchEditingControllerFactory::SetInstance(
TouchSelectionControllerFactory* instance) { TouchEditingControllerFactory* instance) {
g_shared_instance = instance; g_shared_instance = instance;
} }
......
...@@ -54,7 +54,7 @@ class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { ...@@ -54,7 +54,7 @@ class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate {
virtual void ConvertPointFromScreen(gfx::Point* point) = 0; virtual void ConvertPointFromScreen(gfx::Point* point) = 0;
// Returns true if the editable draws its own handles (hence, the // Returns true if the editable draws its own handles (hence, the
// TouchSelectionController need not draw handles). // TouchEditingControllerDeprecated need not draw handles).
virtual bool DrawsHandles() = 0; virtual bool DrawsHandles() = 0;
// Tells the editable to open context menu. // Tells the editable to open context menu.
...@@ -70,12 +70,13 @@ class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { ...@@ -70,12 +70,13 @@ class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate {
// This defines the callback interface for other code to be notified of changes // This defines the callback interface for other code to be notified of changes
// in the state of a TouchEditable. // in the state of a TouchEditable.
class UI_BASE_EXPORT TouchSelectionController { class UI_BASE_EXPORT TouchEditingControllerDeprecated {
public: public:
virtual ~TouchSelectionController() {} virtual ~TouchEditingControllerDeprecated() {}
// Creates a TouchSelectionController. Caller owns the returned object. // Creates a TouchEditingControllerDeprecated. Caller owns the returned
static TouchSelectionController* create( // object.
static TouchEditingControllerDeprecated* Create(
TouchEditable* client_view); TouchEditable* client_view);
// Notifies the controller that the selection has changed. // Notifies the controller that the selection has changed.
...@@ -89,14 +90,15 @@ class UI_BASE_EXPORT TouchSelectionController { ...@@ -89,14 +90,15 @@ class UI_BASE_EXPORT TouchSelectionController {
virtual void HideHandles(bool quick) = 0; virtual void HideHandles(bool quick) = 0;
}; };
class UI_BASE_EXPORT TouchSelectionControllerFactory { class UI_BASE_EXPORT TouchEditingControllerFactory {
public: public:
static void SetInstance(TouchSelectionControllerFactory* instance); static void SetInstance(TouchEditingControllerFactory* instance);
virtual TouchSelectionController* create(TouchEditable* client_view) = 0; virtual TouchEditingControllerDeprecated* Create(TouchEditable* client_view)
= 0;
protected: protected:
virtual ~TouchSelectionControllerFactory() {} virtual ~TouchEditingControllerFactory() {}
}; };
} // namespace ui } // namespace ui
......
...@@ -1835,7 +1835,7 @@ void Textfield::CreateTouchSelectionControllerAndNotifyIt() { ...@@ -1835,7 +1835,7 @@ void Textfield::CreateTouchSelectionControllerAndNotifyIt() {
if (!touch_selection_controller_) { if (!touch_selection_controller_) {
touch_selection_controller_.reset( touch_selection_controller_.reset(
ui::TouchSelectionController::create(this)); ui::TouchEditingControllerDeprecated::Create(this));
} }
if (touch_selection_controller_) if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged(); touch_selection_controller_->SelectionChanged();
......
...@@ -454,7 +454,7 @@ class VIEWS_EXPORT Textfield : public View, ...@@ -454,7 +454,7 @@ class VIEWS_EXPORT Textfield : public View,
gfx::Point last_click_location_; gfx::Point last_click_location_;
gfx::Range double_click_word_; gfx::Range double_click_word_;
scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; scoped_ptr<ui::TouchEditingControllerDeprecated> touch_selection_controller_;
// Used to track touch drag starting location and offset to enable touch // Used to track touch drag starting location and offset to enable touch
// scrolling. // scrolling.
......
...@@ -28,7 +28,7 @@ class TextfieldTestApi { ...@@ -28,7 +28,7 @@ class TextfieldTestApi {
return textfield_->context_menu_contents_.get(); return textfield_->context_menu_contents_.get();
} }
ui::TouchSelectionController* touch_selection_controller() const { ui::TouchEditingControllerDeprecated* touch_selection_controller() const {
return textfield_->touch_selection_controller_.get(); return textfield_->touch_selection_controller_.get();
} }
......
...@@ -239,7 +239,7 @@ class TouchSelectionControllerImpl::EditingHandleView ...@@ -239,7 +239,7 @@ class TouchSelectionControllerImpl::EditingHandleView
window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
new TouchHandleWindowTargeter(window, this))); new TouchHandleWindowTargeter(window, this)));
// We are owned by the TouchSelectionController. // We are owned by the TouchSelectionControllerImpl.
set_owned_by_client(); set_owned_by_client();
} }
...@@ -261,7 +261,7 @@ class TouchSelectionControllerImpl::EditingHandleView ...@@ -261,7 +261,7 @@ class TouchSelectionControllerImpl::EditingHandleView
} }
void DeleteDelegate() override { void DeleteDelegate() override {
// We are owned and deleted by TouchSelectionController. // We are owned and deleted by TouchSelectionControllerImpl.
} }
// Overridden from views::View: // Overridden from views::View:
......
...@@ -20,10 +20,11 @@ namespace test { ...@@ -20,10 +20,11 @@ namespace test {
class WidgetTestInteractive; class WidgetTestInteractive;
} }
// Touch specific implementation of TouchSelectionController. Responsible for // Touch specific implementation of TouchEditingControllerDeprecated.
// displaying selection handles and menu elements relevant in a touch interface. // Responsible for displaying selection handles and menu elements relevant in a
// touch interface.
class VIEWS_EXPORT TouchSelectionControllerImpl class VIEWS_EXPORT TouchSelectionControllerImpl
: public ui::TouchSelectionController, : public ui::TouchEditingControllerDeprecated,
public TouchEditingMenuController, public TouchEditingMenuController,
public aura::WindowObserver, public aura::WindowObserver,
public WidgetObserver, public WidgetObserver,
......
...@@ -65,14 +65,14 @@ class TouchSelectionControllerImplTest : public ViewsTestBase { ...@@ -65,14 +65,14 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
: textfield_widget_(nullptr), : textfield_widget_(nullptr),
widget_(nullptr), widget_(nullptr),
textfield_(nullptr), textfield_(nullptr),
views_tsc_factory_(new ViewsTouchSelectionControllerFactory) { views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
CommandLine::ForCurrentProcess()->AppendSwitch( CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableTouchEditing); switches::kEnableTouchEditing);
ui::TouchSelectionControllerFactory::SetInstance(views_tsc_factory_.get()); ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
} }
~TouchSelectionControllerImplTest() override { ~TouchSelectionControllerImplTest() override {
ui::TouchSelectionControllerFactory::SetInstance(nullptr); ui::TouchEditingControllerFactory::SetInstance(nullptr);
} }
void SetUp() override { void SetUp() override {
...@@ -117,7 +117,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase { ...@@ -117,7 +117,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
protected: protected:
static bool IsCursorHandleVisibleFor( static bool IsCursorHandleVisibleFor(
ui::TouchSelectionController* controller) { ui::TouchEditingControllerDeprecated* controller) {
TouchSelectionControllerImpl* impl = TouchSelectionControllerImpl* impl =
static_cast<TouchSelectionControllerImpl*>(controller); static_cast<TouchSelectionControllerImpl*>(controller);
return impl->IsCursorHandleVisible(); return impl->IsCursorHandleVisible();
...@@ -276,7 +276,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase { ...@@ -276,7 +276,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
Textfield* textfield_; Textfield* textfield_;
scoped_ptr<TextfieldTestApi> textfield_test_api_; scoped_ptr<TextfieldTestApi> textfield_test_api_;
scoped_ptr<ViewsTouchSelectionControllerFactory> views_tsc_factory_; scoped_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_;
scoped_ptr<aura::test::TestCursorClient> test_cursor_client_; scoped_ptr<aura::test::TestCursorClient> test_cursor_client_;
private: private:
...@@ -685,8 +685,8 @@ TEST_F(TouchSelectionControllerImplTest, ...@@ -685,8 +685,8 @@ TEST_F(TouchSelectionControllerImplTest,
CreateWidget(); CreateWidget();
TestTouchEditable touch_editable(widget_->GetNativeView()); TestTouchEditable touch_editable(widget_->GetNativeView());
scoped_ptr<ui::TouchSelectionController> touch_selection_controller( scoped_ptr<ui::TouchEditingControllerDeprecated> touch_selection_controller(
ui::TouchSelectionController::create(&touch_editable)); ui::TouchEditingControllerDeprecated::Create(&touch_editable));
touch_editable.set_bounds(gfx::Rect(0, 0, 100, 20)); touch_editable.set_bounds(gfx::Rect(0, 0, 100, 20));
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
namespace views { namespace views {
ViewsDelegate::ViewsDelegate() ViewsDelegate::ViewsDelegate()
: views_tsc_factory_(new ViewsTouchSelectionControllerFactory) { : views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
ui::TouchSelectionControllerFactory::SetInstance(views_tsc_factory_.get()); ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
} }
ViewsDelegate::~ViewsDelegate() { ViewsDelegate::~ViewsDelegate() {
ui::TouchSelectionControllerFactory::SetInstance(NULL); ui::TouchEditingControllerFactory::SetInstance(NULL);
} }
void ViewsDelegate::SaveWindowPlacement(const Widget* widget, void ViewsDelegate::SaveWindowPlacement(const Widget* widget,
......
...@@ -41,7 +41,7 @@ namespace views { ...@@ -41,7 +41,7 @@ namespace views {
class NativeWidget; class NativeWidget;
class NonClientFrameView; class NonClientFrameView;
class ViewsTouchSelectionControllerFactory; class ViewsTouchEditingControllerFactory;
class View; class View;
class Widget; class Widget;
namespace internal { namespace internal {
...@@ -148,7 +148,7 @@ class VIEWS_EXPORT ViewsDelegate { ...@@ -148,7 +148,7 @@ class VIEWS_EXPORT ViewsDelegate {
static ViewsDelegate* views_delegate; static ViewsDelegate* views_delegate;
private: private:
scoped_ptr<ViewsTouchSelectionControllerFactory> views_tsc_factory_; scoped_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_;
DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); DISALLOW_COPY_AND_ASSIGN(ViewsDelegate);
}; };
......
...@@ -10,13 +10,14 @@ ...@@ -10,13 +10,14 @@
namespace views { namespace views {
class VIEWS_EXPORT ViewsTouchSelectionControllerFactory class VIEWS_EXPORT ViewsTouchEditingControllerFactory
: public ui::TouchSelectionControllerFactory { : public ui::TouchEditingControllerFactory {
public: public:
ViewsTouchSelectionControllerFactory(); ViewsTouchEditingControllerFactory();
// Overridden from ui::TouchSelectionControllerFactory. // Overridden from ui::TouchEditingControllerFactory.
ui::TouchSelectionController* create(ui::TouchEditable* client_view) override; ui::TouchEditingControllerDeprecated* Create(ui::TouchEditable* client_view)
override;
}; };
} // namespace views } // namespace views
......
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
namespace views { namespace views {
ViewsTouchSelectionControllerFactory::ViewsTouchSelectionControllerFactory() { ViewsTouchEditingControllerFactory::ViewsTouchEditingControllerFactory() {
} }
ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( ui::TouchEditingControllerDeprecated*
ViewsTouchEditingControllerFactory::Create(
ui::TouchEditable* client_view) { ui::TouchEditable* client_view) {
if (switches::IsTouchEditingEnabled()) if (switches::IsTouchEditingEnabled())
return new views::TouchSelectionControllerImpl(client_view); return new views::TouchSelectionControllerImpl(client_view);
......
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
namespace views { namespace views {
ViewsTouchSelectionControllerFactory::ViewsTouchSelectionControllerFactory() { ViewsTouchEditingControllerFactory::ViewsTouchEditingControllerFactory() {
} }
ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( ui::TouchEditingControllerDeprecated*
ViewsTouchEditingControllerFactory::Create(
ui::TouchEditable* client_view) { ui::TouchEditable* client_view) {
return NULL; return NULL;
} }
......
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