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() {
if (!touch_selection_controller_) {
touch_selection_controller_.reset(
ui::TouchSelectionController::create(this));
ui::TouchEditingControllerDeprecated::Create(this));
}
if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged();
......
......@@ -90,7 +90,7 @@ class CONTENT_EXPORT TouchEditableImplAura
ui::TextInputType text_input_type_;
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
// change in selection (long press, double tap or triple tap).
......
......@@ -152,7 +152,7 @@ class TouchEditableImplAuraTest : public ContentBrowserTest {
return touch_editable->rwhva_;
}
ui::TouchSelectionController* GetTouchSelectionController(
ui::TouchEditingControllerDeprecated* GetTouchSelectionController(
TouchEditableImplAura* touch_editable) {
return touch_editable->touch_selection_controller_.get();
}
......
......@@ -7,19 +7,19 @@
namespace ui {
namespace {
TouchSelectionControllerFactory* g_shared_instance = NULL;
TouchEditingControllerFactory* g_shared_instance = NULL;
} // namespace
TouchSelectionController* TouchSelectionController::create(
TouchEditingControllerDeprecated* TouchEditingControllerDeprecated::Create(
TouchEditable* client_view) {
if (g_shared_instance)
return g_shared_instance->create(client_view);
return g_shared_instance->Create(client_view);
return NULL;
}
// static
void TouchSelectionControllerFactory::SetInstance(
TouchSelectionControllerFactory* instance) {
void TouchEditingControllerFactory::SetInstance(
TouchEditingControllerFactory* instance) {
g_shared_instance = instance;
}
......
......@@ -54,7 +54,7 @@ class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate {
virtual void ConvertPointFromScreen(gfx::Point* point) = 0;
// 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;
// Tells the editable to open context menu.
......@@ -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
// in the state of a TouchEditable.
class UI_BASE_EXPORT TouchSelectionController {
class UI_BASE_EXPORT TouchEditingControllerDeprecated {
public:
virtual ~TouchSelectionController() {}
virtual ~TouchEditingControllerDeprecated() {}
// Creates a TouchSelectionController. Caller owns the returned object.
static TouchSelectionController* create(
// Creates a TouchEditingControllerDeprecated. Caller owns the returned
// object.
static TouchEditingControllerDeprecated* Create(
TouchEditable* client_view);
// Notifies the controller that the selection has changed.
......@@ -89,14 +90,15 @@ class UI_BASE_EXPORT TouchSelectionController {
virtual void HideHandles(bool quick) = 0;
};
class UI_BASE_EXPORT TouchSelectionControllerFactory {
class UI_BASE_EXPORT TouchEditingControllerFactory {
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:
virtual ~TouchSelectionControllerFactory() {}
virtual ~TouchEditingControllerFactory() {}
};
} // namespace ui
......
......@@ -1835,7 +1835,7 @@ void Textfield::CreateTouchSelectionControllerAndNotifyIt() {
if (!touch_selection_controller_) {
touch_selection_controller_.reset(
ui::TouchSelectionController::create(this));
ui::TouchEditingControllerDeprecated::Create(this));
}
if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged();
......
......@@ -454,7 +454,7 @@ class VIEWS_EXPORT Textfield : public View,
gfx::Point last_click_location_;
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
// scrolling.
......
......@@ -28,7 +28,7 @@ class TextfieldTestApi {
return textfield_->context_menu_contents_.get();
}
ui::TouchSelectionController* touch_selection_controller() const {
ui::TouchEditingControllerDeprecated* touch_selection_controller() const {
return textfield_->touch_selection_controller_.get();
}
......
......@@ -239,7 +239,7 @@ class TouchSelectionControllerImpl::EditingHandleView
window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
new TouchHandleWindowTargeter(window, this)));
// We are owned by the TouchSelectionController.
// We are owned by the TouchSelectionControllerImpl.
set_owned_by_client();
}
......@@ -261,7 +261,7 @@ class TouchSelectionControllerImpl::EditingHandleView
}
void DeleteDelegate() override {
// We are owned and deleted by TouchSelectionController.
// We are owned and deleted by TouchSelectionControllerImpl.
}
// Overridden from views::View:
......
......@@ -20,10 +20,11 @@ namespace test {
class WidgetTestInteractive;
}
// Touch specific implementation of TouchSelectionController. Responsible for
// displaying selection handles and menu elements relevant in a touch interface.
// Touch specific implementation of TouchEditingControllerDeprecated.
// Responsible for displaying selection handles and menu elements relevant in a
// touch interface.
class VIEWS_EXPORT TouchSelectionControllerImpl
: public ui::TouchSelectionController,
: public ui::TouchEditingControllerDeprecated,
public TouchEditingMenuController,
public aura::WindowObserver,
public WidgetObserver,
......
......@@ -65,14 +65,14 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
: textfield_widget_(nullptr),
widget_(nullptr),
textfield_(nullptr),
views_tsc_factory_(new ViewsTouchSelectionControllerFactory) {
views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableTouchEditing);
ui::TouchSelectionControllerFactory::SetInstance(views_tsc_factory_.get());
ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
}
~TouchSelectionControllerImplTest() override {
ui::TouchSelectionControllerFactory::SetInstance(nullptr);
ui::TouchEditingControllerFactory::SetInstance(nullptr);
}
void SetUp() override {
......@@ -117,7 +117,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
protected:
static bool IsCursorHandleVisibleFor(
ui::TouchSelectionController* controller) {
ui::TouchEditingControllerDeprecated* controller) {
TouchSelectionControllerImpl* impl =
static_cast<TouchSelectionControllerImpl*>(controller);
return impl->IsCursorHandleVisible();
......@@ -276,7 +276,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
Textfield* textfield_;
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_;
private:
......@@ -685,8 +685,8 @@ TEST_F(TouchSelectionControllerImplTest,
CreateWidget();
TestTouchEditable touch_editable(widget_->GetNativeView());
scoped_ptr<ui::TouchSelectionController> touch_selection_controller(
ui::TouchSelectionController::create(&touch_editable));
scoped_ptr<ui::TouchEditingControllerDeprecated> touch_selection_controller(
ui::TouchEditingControllerDeprecated::Create(&touch_editable));
touch_editable.set_bounds(gfx::Rect(0, 0, 100, 20));
......
......@@ -9,12 +9,12 @@
namespace views {
ViewsDelegate::ViewsDelegate()
: views_tsc_factory_(new ViewsTouchSelectionControllerFactory) {
ui::TouchSelectionControllerFactory::SetInstance(views_tsc_factory_.get());
: views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
}
ViewsDelegate::~ViewsDelegate() {
ui::TouchSelectionControllerFactory::SetInstance(NULL);
ui::TouchEditingControllerFactory::SetInstance(NULL);
}
void ViewsDelegate::SaveWindowPlacement(const Widget* widget,
......
......@@ -41,7 +41,7 @@ namespace views {
class NativeWidget;
class NonClientFrameView;
class ViewsTouchSelectionControllerFactory;
class ViewsTouchEditingControllerFactory;
class View;
class Widget;
namespace internal {
......@@ -148,7 +148,7 @@ class VIEWS_EXPORT ViewsDelegate {
static ViewsDelegate* views_delegate;
private:
scoped_ptr<ViewsTouchSelectionControllerFactory> views_tsc_factory_;
scoped_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_;
DISALLOW_COPY_AND_ASSIGN(ViewsDelegate);
};
......
......@@ -10,13 +10,14 @@
namespace views {
class VIEWS_EXPORT ViewsTouchSelectionControllerFactory
: public ui::TouchSelectionControllerFactory {
class VIEWS_EXPORT ViewsTouchEditingControllerFactory
: public ui::TouchEditingControllerFactory {
public:
ViewsTouchSelectionControllerFactory();
ViewsTouchEditingControllerFactory();
// Overridden from ui::TouchSelectionControllerFactory.
ui::TouchSelectionController* create(ui::TouchEditable* client_view) override;
// Overridden from ui::TouchEditingControllerFactory.
ui::TouchEditingControllerDeprecated* Create(ui::TouchEditable* client_view)
override;
};
} // namespace views
......
......@@ -9,10 +9,11 @@
namespace views {
ViewsTouchSelectionControllerFactory::ViewsTouchSelectionControllerFactory() {
ViewsTouchEditingControllerFactory::ViewsTouchEditingControllerFactory() {
}
ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create(
ui::TouchEditingControllerDeprecated*
ViewsTouchEditingControllerFactory::Create(
ui::TouchEditable* client_view) {
if (switches::IsTouchEditingEnabled())
return new views::TouchSelectionControllerImpl(client_view);
......
......@@ -6,10 +6,11 @@
namespace views {
ViewsTouchSelectionControllerFactory::ViewsTouchSelectionControllerFactory() {
ViewsTouchEditingControllerFactory::ViewsTouchEditingControllerFactory() {
}
ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create(
ui::TouchEditingControllerDeprecated*
ViewsTouchEditingControllerFactory::Create(
ui::TouchEditable* client_view) {
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