Commit 70aa1e82 authored by mfomitchev's avatar mfomitchev Committed by Commit bot

Revert of Introduce AndroidFocusRules and NativeWidgetAndroid (patchset #13...

Revert of Introduce AndroidFocusRules and NativeWidgetAndroid (patchset #13 id:560001 of https://codereview.chromium.org/1403293003/ )

Reason for revert:
Reverting the CL as the Android Aura project has been cancelled.

Also removing menu_config_android.cc which was added in https://codereview.chromium.org/1477253002.

Original issue's description:
> Introduce AndroidFocusRules and NativeWidgetAndroid
>
> NativeWidgetAndroidis very similar to NativeWidgetAura. It
> owns a WindowTreeHost and FocusController which initialized
> from AndroidFocusRules. Aura on Android should use this
> native widget for top level windows. It should create and host
> the Widget in a native Android window.
>
> BUG=507792
>
> Committed: https://crrev.com/31db6ee3532c748f40d2ae00514b5d91031d78e7
> Cr-Commit-Position: refs/heads/master@{#360645}

TBR=sadrul@chromium.org,sky@chromium.org,bshe@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=507792

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

Cr-Commit-Position: refs/heads/master@{#371918}
parent e6dc3f42
......@@ -53,10 +53,6 @@
#include "ui/views/linux_ui/linux_ui.h"
#endif
#if defined(OS_ANDROID)
#include "ui/views/widget/android/native_widget_android.h"
#endif
#if defined(USE_ASH)
#include "ash/accelerators/accelerator_controller.h"
#include "ash/shell.h"
......@@ -438,11 +434,7 @@ void ChromeViewsDelegate::OnBeforeWidgetInit(
params->context ? params->context : params->parent;
if (chrome::GetHostDesktopTypeForNativeView(to_check) ==
chrome::HOST_DESKTOP_TYPE_NATIVE) {
#if defined(OS_ANDROID)
params->native_widget = new views::NativeWidgetAndroid(delegate);
#else
params->native_widget = new views::DesktopNativeWidgetAura(delegate);
#endif
}
}
#endif
......
......@@ -128,9 +128,6 @@ component("views") {
sources += gypi_values.views_desktop_aura_linux_sources
}
}
if (is_android) {
sources += gypi_values.views_android_sources
}
}
if (is_mac) {
......
// Copyright 2015 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 "ui/views/controls/menu/menu_config.h"
namespace views {
void MenuConfig::Init() {
// Android uses the config provided by data member initializers.
}
} // namespace views
......@@ -410,13 +410,6 @@
'widget/window_reorderer.cc',
'widget/window_reorderer.h',
],
'views_android_sources': [
'controls/menu/menu_config_android.cc',
'widget/android/android_focus_rules.cc',
'widget/android/android_focus_rules.h',
'widget/android/native_widget_android.cc',
'widget/android/native_widget_android.h',
],
'views_desktop_aura_sources': [
'widget/desktop_aura/desktop_capture_client.cc',
'widget/desktop_aura/desktop_capture_client.h',
......
// Copyright 2015 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 "ui/views/widget/android/android_focus_rules.h"
#include "ui/aura/window.h"
namespace views {
AndroidFocusRules::AndroidFocusRules() {}
AndroidFocusRules::~AndroidFocusRules() {}
bool AndroidFocusRules::SupportsChildActivation(aura::Window* window) const {
return window->IsRootWindow();
}
} // namespace views
// Copyright 2015 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 UI_VIEWS_WIDGET_ANDROID_ANDROID_FOCUS_RULES_H_
#define UI_VIEWS_WIDGET_ANDROID_ANDROID_FOCUS_RULES_H_
#include "base/macros.h"
#include "ui/wm/core/base_focus_rules.h"
namespace views {
// A set of focus rules for Android using aura.
class AndroidFocusRules : public wm::BaseFocusRules {
public:
AndroidFocusRules();
~AndroidFocusRules() override;
private:
// wm::BaseFocusRules:
bool SupportsChildActivation(aura::Window* window) const override;
DISALLOW_COPY_AND_ASSIGN(AndroidFocusRules);
};
} // namespace views
#endif // UI_VIEWS_WIDGET_ANDROID_ANDROID_FOCUS_RULES_H_
This diff is collapsed.
// Copyright 2015 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 UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_
#define UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_tree_host_observer.h"
#include "ui/base/cursor/cursor.h"
#include "ui/events/event_constants.h"
#include "ui/views/views_export.h"
#include "ui/views/widget/native_widget_private.h"
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_delegate.h"
#include "ui/wm/public/drag_drop_delegate.h"
namespace aura {
class Window;
class WindowTreeHost;
namespace client {
class DefaultCaptureClient;
class DispatcherClient;
class ScreenPositionClient;
class WindowTreeClient;
}
}
namespace gfx {
class FontList;
}
namespace wm {
class FocusController;
}
namespace views {
class TooltipManagerAura;
class WindowReorderer;
// NativeWidgetAndroid creates and hosts the Widget in an Android native window.
// It is used to create a top level window on Android platform.
class VIEWS_EXPORT NativeWidgetAndroid
: public internal::NativeWidgetPrivate,
public aura::WindowDelegate,
public aura::client::ActivationDelegate,
public aura::client::ActivationChangeObserver,
public aura::client::FocusChangeObserver,
public aura::client::DragDropDelegate,
public aura::WindowTreeHostObserver {
public:
explicit NativeWidgetAndroid(internal::NativeWidgetDelegate* delegate);
aura::WindowTreeHost* host() { return host_.get(); }
// Overridden from internal::NativeWidgetPrivate:
void InitNativeWidget(const Widget::InitParams& params) override;
void OnWidgetInitDone() override;
NonClientFrameView* CreateNonClientFrameView() override;
bool ShouldUseNativeFrame() const override;
bool ShouldWindowContentsBeTransparent() const override;
void FrameTypeChanged() override;
Widget* GetWidget() override;
const Widget* GetWidget() const override;
gfx::NativeView GetNativeView() const override;
gfx::NativeWindow GetNativeWindow() const override;
Widget* GetTopLevelWidget() override;
const ui::Compositor* GetCompositor() const override;
const ui::Layer* GetLayer() const override;
void ReorderNativeViews() override;
void ViewRemoved(View* view) override;
void SetNativeWindowProperty(const char* name, void* value) override;
void* GetNativeWindowProperty(const char* name) const override;
TooltipManager* GetTooltipManager() const override;
void SetCapture() override;
void ReleaseCapture() override;
bool HasCapture() const override;
ui::InputMethod* GetInputMethod() override;
void CenterWindow(const gfx::Size& size) override;
void GetWindowPlacement(gfx::Rect* bounds,
ui::WindowShowState* maximized) const override;
bool SetWindowTitle(const base::string16& title) override;
void SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) override;
void InitModalType(ui::ModalType modal_type) override;
gfx::Rect GetWindowBoundsInScreen() const override;
gfx::Rect GetClientAreaBoundsInScreen() const override;
gfx::Rect GetRestoredBounds() const override;
void SetBounds(const gfx::Rect& bounds) override;
void SetSize(const gfx::Size& size) override;
void StackAbove(gfx::NativeView native_view) override;
void StackAtTop() override;
void StackBelow(gfx::NativeView native_view) override;
void SetShape(SkRegion* shape) override;
void Close() override;
void CloseNow() override;
void Show() override;
void Hide() override;
void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) override;
void ShowWithWindowState(ui::WindowShowState state) override;
bool IsVisible() const override;
void Activate() override;
void Deactivate() override;
bool IsActive() const override;
void SetAlwaysOnTop(bool always_on_top) override;
bool IsAlwaysOnTop() const override;
void SetVisibleOnAllWorkspaces(bool always_visible) override;
void Maximize() override;
void Minimize() override;
bool IsMaximized() const override;
bool IsMinimized() const override;
void Restore() override;
void SetFullscreen(bool fullscreen) override;
bool IsFullscreen() const override;
void SetOpacity(unsigned char opacity) override;
void SetUseDragFrame(bool use_drag_frame) override;
void FlashFrame(bool flash_frame) override;
void RunShellDrag(View* view,
const ui::OSExchangeData& data,
const gfx::Point& location,
int operation,
ui::DragDropTypes::DragEventSource source) override;
void SchedulePaintInRect(const gfx::Rect& rect) override;
void SetCursor(gfx::NativeCursor cursor) override;
bool IsMouseEventsEnabled() const override;
void ClearNativeFocus() override;
gfx::Rect GetWorkAreaBoundsInScreen() const override;
Widget::MoveLoopResult RunMoveLoop(
const gfx::Vector2d& drag_offset,
Widget::MoveLoopSource source,
Widget::MoveLoopEscapeBehavior escape_behavior) override;
void EndMoveLoop() override;
void SetVisibilityChangedAnimationsEnabled(bool value) override;
void SetVisibilityAnimationDuration(const base::TimeDelta& duration) override;
void SetVisibilityAnimationTransition(
Widget::VisibilityTransition transition) override;
ui::NativeTheme* GetNativeTheme() const override;
void OnRootViewLayout() override;
bool IsTranslucentWindowOpacitySupported() const override;
void OnSizeConstraintsChanged() override;
void RepostNativeEvent(gfx::NativeEvent native_event) override;
// Overridden from aura::WindowDelegate:
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
gfx::NativeCursor GetCursor(const gfx::Point& point) override;
int GetNonClientComponent(const gfx::Point& point) const override;
bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
const gfx::Point& location) override;
bool CanFocus() override;
void OnCaptureLost() override;
void OnPaint(const ui::PaintContext& context) override;
void OnDeviceScaleFactorChanged(float device_scale_factor) override;
void OnWindowDestroying(aura::Window* window) override;
void OnWindowDestroyed(aura::Window* window) override;
void OnWindowTargetVisibilityChanged(bool visible) override;
bool HasHitTestMask() const override;
void GetHitTestMask(gfx::Path* mask) const override;
// Overridden from ui::EventHandler:
void OnKeyEvent(ui::KeyEvent* event) override;
void OnMouseEvent(ui::MouseEvent* event) override;
void OnScrollEvent(ui::ScrollEvent* event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
// Overridden from aura::client::ActivationDelegate:
bool ShouldActivate() const override;
// Overridden from aura::client::ActivationChangeObserver:
void OnWindowActivated(
aura::client::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
aura::Window* lost_active) override;
// Overridden from aura::client::FocusChangeObserver:
void OnWindowFocused(aura::Window* gained_focus,
aura::Window* lost_focus) override;
// Overridden from aura::client::DragDropDelegate:
void OnDragEntered(const ui::DropTargetEvent& event) override;
int OnDragUpdated(const ui::DropTargetEvent& event) override;
void OnDragExited() override;
int OnPerformDrop(const ui::DropTargetEvent& event) override;
// Overridden from aura::WindowTreeHostObserver:
void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
void OnHostResized(const aura::WindowTreeHost* host) override;
void OnHostMoved(const aura::WindowTreeHost* host,
const gfx::Point& new_origin) override;
protected:
~NativeWidgetAndroid() override;
internal::NativeWidgetDelegate* delegate() { return delegate_; }
private:
class ActiveWindowObserver;
bool IsDocked() const;
void SetInitialFocus(ui::WindowShowState show_state);
internal::NativeWidgetDelegate* delegate_;
// WARNING: set to NULL when destroyed. As the Widget is not necessarily
// destroyed along with |window_| all usage of |window_| should first verify
// non-NULL.
aura::Window* window_;
// See class documentation for Widget in widget.h for a note about ownership.
Widget::InitParams::Ownership ownership_;
// Are we in the destructor?
bool destroying_;
gfx::NativeCursor cursor_;
// The saved window state for exiting full screen state.
ui::WindowShowState saved_window_state_;
scoped_ptr<TooltipManagerAura> tooltip_manager_;
// Reorders child windows of |window_| associated with a view based on the
// order of the associated views in the widget's view hierarchy.
scoped_ptr<WindowReorderer> window_reorderer_;
scoped_ptr<aura::WindowTreeHost> host_;
scoped_ptr<wm::FocusController> focus_client_;
scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_;
scoped_ptr<aura::client::DispatcherClient> dispatcher_client_;
// The following factory is used for calls to close the
// NativeWidgetAndroid instance.
base::WeakPtrFactory<NativeWidgetAndroid> close_widget_factory_;
DISALLOW_COPY_AND_ASSIGN(NativeWidgetAndroid);
};
} // namespace views
#endif // UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_
......@@ -42,8 +42,8 @@ class VIEWS_EXPORT NativeWidgetAura
public:
explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate);
// Called internally by NativeWidget implementations to associate
// |native_widget| with |window|.
// Called internally by NativeWidgetAura and DesktopNativeWidgetAura to
// associate |native_widget| with |window|.
static void RegisterNativeWidgetForWindow(
internal::NativeWidgetPrivate* native_widget,
aura::Window* window);
......
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