summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/all.gyp3
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/browser/about_flags.cc9
-rw-r--r--chrome/browser/chrome_browser_main.cc9
-rw-r--r--chrome/browser/chrome_browser_parts_views.cc26
-rw-r--r--chrome/browser/chrome_content_browser_client.cc7
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc1
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc10
-rw-r--r--chrome/browser/extensions/extension_input_api.cc7
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views.cc1166
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views.h319
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views_touch.cc178
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views_win.cc26
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views_unittest.cc1
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc1
-rw-r--r--chrome/browser/ui/views/bubble/bubble.cc6
-rw-r--r--chrome/browser/ui/views/bubble/bubble.h7
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc7
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.h3
-rw-r--r--chrome/browser/ui/views/constrained_window_views.cc16
-rw-r--r--chrome/browser/ui/views/dom_view.cc15
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_gtk.cc4
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_views.cc37
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_views.h46
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.cc4
-rw-r--r--chrome/browser/ui/views/menu_model_adapter_test.cc4
-rw-r--r--chrome/browser/ui/views/native_constrained_window_views.cc46
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc1
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc3
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.cc140
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h44
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc3
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc1
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc3
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.cc133
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h52
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc3
-rw-r--r--chrome/chrome_browser.gypi24
-rw-r--r--chrome/chrome_common.gypi6
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/common/native_web_keyboard_event_views.cc93
-rw-r--r--chrome/common/native_web_keyboard_event_views.h33
-rw-r--r--ui/aura_shell/aura_shell.gyp16
-rw-r--r--ui/views/aura_desktop/aura_desktop_main.cc188
-rw-r--r--ui/views/desktop/desktop_background.cc55
-rw-r--r--ui/views/desktop/desktop_background.h29
-rw-r--r--ui/views/desktop/desktop_main.cc90
-rw-r--r--ui/views/desktop/desktop_views_delegate.cc76
-rw-r--r--ui/views/desktop/desktop_views_delegate.h51
-rw-r--r--ui/views/desktop/desktop_window_manager.cc305
-rw-r--r--ui/views/desktop/desktop_window_manager.h99
-rw-r--r--ui/views/desktop/desktop_window_view.cc295
-rw-r--r--ui/views/desktop/desktop_window_view.h100
-rw-r--r--ui/views/events/event_wayland.cc23
-rw-r--r--ui/views/examples/examples_main.cc2
-rw-r--r--ui/views/focus/accelerator_handler_touch.cc188
-rw-r--r--ui/views/ime/input_method_wayland.cc76
-rw-r--r--ui/views/ime/input_method_wayland.h36
-rw-r--r--ui/views/test/test_views_delegate.cc7
-rw-r--r--ui/views/test/test_views_delegate.h6
-rw-r--r--ui/views/touchui/gesture_manager.cc32
-rw-r--r--views/controls/combobox/native_combobox_wayland.cc15
-rw-r--r--views/controls/native/native_view_host.cc23
-rw-r--r--views/controls/native/native_view_host.h11
-rw-r--r--views/controls/native/native_view_host_gtk.cc4
-rw-r--r--views/controls/native/native_view_host_views.cc82
-rw-r--r--views/controls/native/native_view_host_views.h47
-rw-r--r--views/controls/native/native_view_host_wayland.cc16
-rw-r--r--views/metrics_wayland.cc17
-rw-r--r--views/view.cc1
-rw-r--r--views/view_unittest.cc48
-rw-r--r--views/view_wayland.cc24
-rw-r--r--views/views.gyp201
-rw-r--r--views/views_delegate.h6
-rw-r--r--views/widget/native_widget_aura.h3
-rw-r--r--views/widget/native_widget_delegate.h11
-rw-r--r--views/widget/native_widget_gtk.cc19
-rw-r--r--views/widget/native_widget_view.cc178
-rw-r--r--views/widget/native_widget_view.h101
-rw-r--r--views/widget/native_widget_views.cc648
-rw-r--r--views/widget/native_widget_views.h190
-rw-r--r--views/widget/native_widget_wayland.cc683
-rw-r--r--views/widget/native_widget_wayland.h215
-rw-r--r--views/widget/native_widget_win.cc5
-rw-r--r--views/widget/widget_unittest.cc238
86 files changed, 124 insertions, 6843 deletions
diff --git a/build/all.gyp b/build/all.gyp
index bddea7a..fd49210 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -611,9 +611,6 @@
'../ui/aura/aura.gyp:*',
'../ui/gfx/compositor/compositor.gyp:*',
'../views/views.gyp:views',
- '../views/views.gyp:views_aura_desktop',
- '../views/views.gyp:views_desktop',
- '../views/views.gyp:views_desktop_lib',
'../views/views.gyp:views_unittests',
'../webkit/webkit.gyp:pull_in_webkit_unit_tests',
],
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 8a82960..b980686 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4554,12 +4554,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_DISABLE_SHORTCUTS_PROVIDER_DESCRIPTION" desc=" Description of the 'Disable better ranking of previously selected shortcuts in omnibox' lab.">
Remembers commonly selected autocomplete results based on the omnibox search term and offers those URLs the next time that same search term is typed.
</message>
- <message name="IDS_FLAGS_DISABLE_VIEWS_DESKTOP_NAME" desc="Name of the 'Disable desktop' lab.">
- Disable desktop
- </message>
- <message name="IDS_FLAGS_DISABLE_VIEWS_DESKTOP_DESCRIPTION" desc="Description of the 'Disable desktop' lab.">
- Uses the Views Desktop environment for Chrome.
- </message>
<message name="IDS_FLAGS_ENABLE_BLUETOOTH_NAME" desc="Name of the 'Bluetooth' lab.">
Bluetooth
</message>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index dd51536..4b600e1 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -340,15 +340,6 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE("")
#endif
},
-#if defined(TOUCH_UI)
- {
- "touchui-views-desktop",
- IDS_FLAGS_DISABLE_VIEWS_DESKTOP_NAME,
- IDS_FLAGS_DISABLE_VIEWS_DESKTOP_DESCRIPTION,
- kOsCrOS,
- SINGLE_VALUE_TYPE_AND_VALUE(switches::kViewsDesktop, "disabled")
- },
-#endif
{
"downloads-new-ui", // FLAGS:RECORD_UMA
IDS_FLAGS_DOWNLOADS_NEW_UI_NAME,
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 95efc73..0dae0ac 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -1344,15 +1344,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
}
#endif
-#if defined(TOUCH_UI)
- // Always add the --views-desktop flag, if not already set.
- // If the user disabled the flag from about:flags, it will get unset by the
- // call to ConvertFlagsToSwitches in the following line.
- if (!parsed_command_line().HasSwitch(switches::kViewsDesktop))
- CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kViewsDesktop,
- "other");
-#endif
-
// Convert active labs into switches. Modifies the current command line.
about_flags::ConvertFlagsToSwitches(local_state,
CommandLine::ForCurrentProcess());
diff --git a/chrome/browser/chrome_browser_parts_views.cc b/chrome/browser/chrome_browser_parts_views.cc
index 3191108..328eb7c 100644
--- a/chrome/browser/chrome_browser_parts_views.cc
+++ b/chrome/browser/chrome_browser_parts_views.cc
@@ -9,7 +9,6 @@
#include "base/command_line.h"
#include "chrome/browser/ui/views/chrome_views_delegate.h"
#include "chrome/common/chrome_switches.h"
-#include "ui/views/desktop/desktop_window_view.h"
#include "views/widget/widget.h"
ChromeBrowserPartsViews::ChromeBrowserPartsViews()
@@ -28,31 +27,6 @@ void ChromeBrowserPartsViews::ToolkitInitialized() {
}
void ChromeBrowserPartsViews::PreMainMessageLoopRun() {
-#if !defined(USE_AURA)
- views::Widget::SetPureViews(
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kUsePureViews));
- // Launch the views desktop shell window and register it as the default parent
- // for all unparented views widgets.
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kViewsDesktop)) {
- std::string desktop_type_cmd =
- command_line.GetSwitchValueASCII(switches::kViewsDesktop);
- if (desktop_type_cmd != "disabled") {
- views::desktop::DesktopWindowView::DesktopType desktop_type;
- if (desktop_type_cmd == "netbook")
- desktop_type = views::desktop::DesktopWindowView::DESKTOP_NETBOOK;
- else if (desktop_type_cmd == "other")
- desktop_type = views::desktop::DesktopWindowView::DESKTOP_OTHER;
- else
- desktop_type = views::desktop::DesktopWindowView::DESKTOP_DEFAULT;
- views::desktop::DesktopWindowView::CreateDesktopWindow(desktop_type);
- ChromeViewsDelegate* chrome_views_delegate = static_cast
- <ChromeViewsDelegate*>(views::ViewsDelegate::views_delegate);
- chrome_views_delegate->default_parent_view =
- views::desktop::DesktopWindowView::desktop_window_view;
- }
- }
-#endif
}
bool ChromeBrowserPartsViews::MainMessageLoopRun(int* result_code) {
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 303f267..018acf5 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -128,10 +128,7 @@
#if defined(USE_AURA)
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
-#elif defined(TOUCH_UI)
-#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
#elif defined(OS_WIN)
-#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
#include "content/browser/renderer_host/render_widget_host_view_win.h"
#elif defined(TOOLKIT_USES_GTK)
#include "content/browser/renderer_host/render_widget_host_view_gtk.h"
@@ -262,11 +259,7 @@ RenderWidgetHostView* ChromeContentBrowserClient::CreateViewForWidget(
RenderWidgetHost* widget) {
#if defined(USE_AURA)
return new RenderWidgetHostViewAura(widget);
-#elif defined(TOUCH_UI)
- return new RenderWidgetHostViewViews(widget);
#elif defined(OS_WIN)
- if (views::Widget::IsPureViews())
- return new RenderWidgetHostViewViews(widget);
return new RenderWidgetHostViewWin(widget);
#elif defined(TOOLKIT_USES_GTK)
return new RenderWidgetHostViewGtk(widget);
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index f2273b6..6ef63a6 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -970,7 +970,6 @@ std::string LoginUtilsImpl::GetOffTheRecordCommandLine(
switches::kPpapiFlashInProcess,
switches::kPpapiFlashPath,
switches::kPpapiFlashVersion,
- switches::kViewsDesktop,
switches::kTouchDevices,
#if defined(TOUCH_UI)
// The virtual keyboard extension for TOUCH_UI (chrome://keyboard) highly
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 11fcd7f..df13daa 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -24,7 +24,6 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
-#include "ui/views/desktop/desktop_window_view.h"
#include "views/widget/widget.h"
#if defined(TOOLKIT_USES_GTK)
@@ -302,14 +301,11 @@ void WebUILoginView::OnTabMainFrameFirstRender() {
bool emit_login_visible = false;
- // In aura or views-desktop environment, there will be no window-manager. So
- // chrome needs to emit the 'login-prompt-visible' signal. This needs to
- // happen here, after the page has completed rendering itself.
+ // In aura, there will be no window-manager. So chrome needs to emit the
+ // 'login-prompt-visible' signal. This needs to happen here, after the page
+ // has completed rendering itself.
#if defined(USE_AURA)
emit_login_visible = true;
-#else
- if (views::desktop::DesktopWindowView::desktop_window_view)
- emit_login_visible = true;
#endif
if (emit_login_visible)
chromeos::DBusThreadManager::Get()->GetSessionManagerClient()
diff --git a/chrome/browser/extensions/extension_input_api.cc b/chrome/browser/extensions/extension_input_api.cc
index fe231d8..4cd134a 100644
--- a/chrome/browser/extensions/extension_input_api.cc
+++ b/chrome/browser/extensions/extension_input_api.cc
@@ -74,13 +74,6 @@ uint16 UnicodeIdentifierStringToInt(const std::string& key_identifier) {
}
views::Widget* GetTopLevelWidget(Browser* browser) {
- if (views::ViewsDelegate::views_delegate) {
- views::View* view = views::ViewsDelegate::views_delegate->
- GetDefaultParentView();
- if (view)
- return view->GetWidget();
- }
-
#if defined(OS_CHROMEOS) && defined(TOUCH_UI)
chromeos::LoginDisplayHost* host =
chromeos::BaseLoginDisplayHost::default_host();
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc
deleted file mode 100644
index 3a82310..0000000
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ /dev/null
@@ -1,1166 +0,0 @@
-// Copyright (c) 2011 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/renderer_host/render_widget_host_view_views.h"
-
-#include <algorithm>
-#include <string>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "base/metrics/histogram.h"
-#include "base/string_number_conversions.h"
-#include "base/time.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/native_web_keyboard_event_views.h"
-#include "chrome/common/render_messages.h"
-#include "content/browser/renderer_host/backing_store_skia.h"
-#include "content/browser/renderer_host/render_widget_host.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/common/result_codes.h"
-#include "grit/ui_strings.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h"
-#include "ui/base/clipboard/clipboard.h"
-#include "ui/base/text/text_elider.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/canvas_skia.h"
-#include "ui/views/events/event.h"
-#include "ui/views/ime/input_method.h"
-#include "views/views_delegate.h"
-#include "views/widget/tooltip_manager.h"
-#include "views/widget/widget.h"
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
-#include "content/browser/renderer_host/accelerated_surface_container_linux.h"
-#include "ui/gfx/gl/gl_bindings.h"
-#endif
-
-#if defined(TOOLKIT_USES_GTK)
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkwindow.h>
-
-#include "content/browser/renderer_host/gtk_window_utils.h"
-#include "views/widget/native_widget_gtk.h"
-#endif
-
-#if defined(OS_POSIX)
-#include "content/browser/renderer_host/gtk_window_utils.h"
-#endif
-
-static const int kMaxWindowWidth = 4000;
-static const int kMaxWindowHeight = 4000;
-static const int kTouchControllerUpdateDelay = 150;
-
-// static
-const char RenderWidgetHostViewViews::kViewClassName[] =
- "browser/renderer_host/RenderWidgetHostViewViews";
-
-using WebKit::WebInputEventFactory;
-using WebKit::WebMouseWheelEvent;
-using WebKit::WebTouchEvent;
-
-namespace {
-
-int WebInputEventFlagsFromViewsEvent(const views::Event& event) {
- int modifiers = 0;
-
- if (event.IsShiftDown())
- modifiers |= WebKit::WebInputEvent::ShiftKey;
- if (event.IsControlDown())
- modifiers |= WebKit::WebInputEvent::ControlKey;
- if (event.IsAltDown())
- modifiers |= WebKit::WebInputEvent::AltKey;
- if (event.IsCapsLockDown())
- modifiers |= WebKit::WebInputEvent::CapsLockOn;
-
- return modifiers;
-}
-
-void InitializeWebMouseEventFromViewsEvent(const views::LocatedEvent& event,
- const gfx::Point& origin,
- WebKit::WebMouseEvent* wmevent) {
- wmevent->timeStampSeconds = base::Time::Now().ToDoubleT();
- wmevent->modifiers = WebInputEventFlagsFromViewsEvent(event);
-
- wmevent->windowX = wmevent->x = event.x();
- wmevent->windowY = wmevent->y = event.y();
- wmevent->globalX = wmevent->x + origin.x();
- wmevent->globalY = wmevent->y + origin.y();
-}
-
-} // namespace
-
-RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host)
- : host_(host),
- about_to_validate_and_paint_(false),
- is_hidden_(false),
- is_loading_(false),
- native_cursor_(gfx::kNullCursor),
- is_showing_context_menu_(false),
- visually_deemphasized_(false),
- touch_event_(),
- text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
- has_composition_text_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(touch_selection_controller_(
- views::TouchSelectionController::create(this))),
- ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
- set_focusable(true);
- host_->SetView(this);
-
-#if defined(TOUCH_UI)
- SetPaintToLayer(true);
- registrar_.Add(this,
- chrome::NOTIFICATION_KEYBOARD_VISIBLE_BOUNDS_CHANGED,
- content::NotificationService::AllSources());
-#endif
-}
-
-RenderWidgetHostViewViews::~RenderWidgetHostViewViews() {
-}
-
-void RenderWidgetHostViewViews::InitAsChild() {
- Show();
-}
-
-void RenderWidgetHostViewViews::InitAsPopup(
- RenderWidgetHostView* parent_host_view,
- const gfx::Rect& pos) {
- RenderWidgetHostViewViews* parent =
- static_cast<RenderWidgetHostViewViews*>(parent_host_view);
- parent->AddChildView(this);
- // If the parent loses focus then the popup will close. So we need
- // to tell the parent it's showing a popup so that it doesn't respond to
- // blurs.
- parent->is_showing_context_menu_ = true;
-
- // pos is in screen coordinates but a view is positioned relative
- // to its parent. Here we convert screen coordinates to relative
- // coordinates.
- gfx::Point p(pos.x() - parent_host_view->GetViewBounds().x(),
- pos.y() - parent_host_view->GetViewBounds().y());
- views::View::SetBounds(p.x(), p.y(), pos.width(), pos.height());
- Show();
-
- if (NeedsInputGrab()) {
- set_focusable(true);
- RequestFocus();
- }
-}
-
-void RenderWidgetHostViewViews::InitAsFullscreen(
- RenderWidgetHostView* /*reference_host_view*/) {
- NOTIMPLEMENTED();
-}
-
-RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const {
- return host_;
-}
-
-void RenderWidgetHostViewViews::DidBecomeSelected() {
- if (!is_hidden_)
- return;
-
- if (tab_switch_paint_time_.is_null())
- tab_switch_paint_time_ = base::TimeTicks::Now();
- is_hidden_ = false;
- if (host_)
- host_->WasRestored();
-}
-
-void RenderWidgetHostViewViews::WasHidden() {
- if (is_hidden_)
- return;
-
- // If we receive any more paint messages while we are hidden, we want to
- // ignore them so we don't re-allocate the backing store. We will paint
- // everything again when we become selected again.
- is_hidden_ = true;
-
- // If we have a renderer, then inform it that we are being hidden so it can
- // reduce its resource utilization.
- if (host_)
- host_->WasHidden();
-
- weak_factory_.InvalidateWeakPtrs();
-}
-
-void RenderWidgetHostViewViews::SetSize(const gfx::Size& size) {
- // This is called when webkit has sent us a Move message.
- int width = std::min(size.width(), kMaxWindowWidth);
- int height = std::min(size.height(), kMaxWindowHeight);
- if (requested_size_.width() != width ||
- requested_size_.height() != height) {
- requested_size_ = gfx::Size(width, height);
- views::View::SetBounds(x(), y(), width, height);
- if (host_)
- host_->WasResized();
- }
-}
-
-void RenderWidgetHostViewViews::SetBounds(const gfx::Rect& rect) {
- // TODO(oshima): chromeos/touch doesn't allow moving window.
- SetSize(rect.size());
-}
-
-gfx::NativeView RenderWidgetHostViewViews::GetNativeView() const {
- // TODO(oshima): There is no native view here for RWHVV.
- // Use top level widget's native view for now. This is not
- // correct and has to be fixed somehow.
- return GetWidget() ? GetWidget()->GetNativeView() : NULL;
-}
-
-gfx::NativeViewId RenderWidgetHostViewViews::GetNativeViewId() const {
-#if defined(OS_WIN)
- // TODO(oshima): Windows uses message filter to handle inquiry for
- // window/screen info, which requires HWND. Just pass the
- // browser window's HWND (same as before) for now.
- return reinterpret_cast<gfx::NativeViewId>(GetNativeView());
-#else
- return reinterpret_cast<gfx::NativeViewId>(
- const_cast<RenderWidgetHostViewViews*>(this));
-#endif
-}
-
-void RenderWidgetHostViewViews::MovePluginWindows(
- const std::vector<webkit::npapi::WebPluginGeometry>& moves) {
- // TODO(anicolao): NIY
- // NOTIMPLEMENTED();
-}
-
-bool RenderWidgetHostViewViews::HasFocus() const {
- return View::HasFocus();
-}
-
-void RenderWidgetHostViewViews::Show() {
- SetVisible(true);
-}
-
-void RenderWidgetHostViewViews::Hide() {
- SetVisible(false);
-}
-
-bool RenderWidgetHostViewViews::IsShowing() {
- return IsVisible();
-}
-
-gfx::Rect RenderWidgetHostViewViews::GetViewBounds() const {
- return GetScreenBounds();
-}
-
-void RenderWidgetHostViewViews::SetIsLoading(bool is_loading) {
- is_loading_ = is_loading;
-#if defined(TOOLKIT_USES_GTK)
- // Only call ShowCurrentCursor() when it will actually change the cursor.
- if (current_cursor_.GetCursorType() == GDK_LAST_CURSOR)
- ShowCurrentCursor();
-#endif // TOOLKIT_USES_GTK
-}
-
-void RenderWidgetHostViewViews::TextInputStateChanged(
- ui::TextInputType type,
- bool can_compose_inline) {
- // TODO(kinaba): currently, can_compose_inline is ignored and always treated
- // as true. We need to support "can_compose_inline=false" for PPAPI plugins
- // that may want to avoid drawing composition-text by themselves and pass
- // the responsibility to the browser.
-
- // This is async message and by the time the ipc arrived,
- // RWHVV may be detached from Top level widget, in which case
- // GetInputMethod may return NULL;
- views::InputMethod* input_method = GetInputMethod();
-
- if (text_input_type_ != type) {
- text_input_type_ = type;
- if (input_method)
- input_method->OnTextInputTypeChanged(this);
- }
-}
-
-void RenderWidgetHostViewViews::ImeCancelComposition() {
- DCHECK(GetInputMethod());
- GetInputMethod()->CancelComposition(this);
- has_composition_text_ = false;
-}
-
-void RenderWidgetHostViewViews::DidUpdateBackingStore(
- const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
- const std::vector<gfx::Rect>& copy_rects) {
- if (is_hidden_)
- return;
-
- // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that
- // be done using XCopyArea? Perhaps similar to
- // BackingStore::ScrollBackingStore?
- if (about_to_validate_and_paint_)
- invalid_rect_ = invalid_rect_.Union(scroll_rect);
- else
- SchedulePaintInRect(scroll_rect);
-
- for (size_t i = 0; i < copy_rects.size(); ++i) {
- // Avoid double painting. NOTE: This is only relevant given the call to
- // Paint(scroll_rect) above.
- gfx::Rect rect = copy_rects[i].Subtract(scroll_rect);
- if (rect.IsEmpty())
- continue;
-
- if (about_to_validate_and_paint_)
- invalid_rect_ = invalid_rect_.Union(rect);
- else
- SchedulePaintInRect(rect);
- }
- invalid_rect_ = invalid_rect_.Intersect(bounds());
-}
-
-void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status,
- int error_code) {
- DCHECK(host_);
- host_->ViewDestroyed();
- Destroy();
-}
-
-void RenderWidgetHostViewViews::Destroy() {
- // host_'s destruction brought us here, null it out so we don't use it
- host_ = NULL;
- if (parent()) {
- if (IsPopup()) {
- static_cast<RenderWidgetHostViewViews*>
- (parent())->is_showing_context_menu_ = false;
- // We're hiding the popup so we need to make sure we repaint
- // what's underneath.
- parent()->SchedulePaintInRect(bounds());
- }
- parent()->RemoveChildView(this);
- }
- MessageLoop::current()->DeleteSoon(FROM_HERE, this);
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- // Send out all outstanding ACKs so that we don't block the GPU
- // process.
- for (std::vector< base::Callback<void(void)> >::const_iterator
- it = on_compositing_ended_callbacks_.begin();
- it != on_compositing_ended_callbacks_.end(); ++it) {
- it->Run();
- }
- on_compositing_ended_callbacks_.clear();
-
- // Remove dangling reference.
- if (GetWidget() && GetWidget()->GetCompositor()) {
- ui::Compositor *compositor = GetWidget()->GetCompositor();
- if (compositor->HasObserver(this))
- compositor->RemoveObserver(this);
- }
-#endif
-}
-
-void RenderWidgetHostViewViews::SetTooltipText(const string16& tip) {
- const int kMaxTooltipLength = 8 << 10;
- // Clamp the tooltip length to kMaxTooltipLength so that we don't
- // accidentally DOS the user with a mega tooltip.
- tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength);
- if (GetWidget())
- GetWidget()->TooltipTextChanged(this);
-}
-
-void RenderWidgetHostViewViews::SelectionChanged(const string16& text,
- size_t offset,
- const ui::Range& range) {
- RenderWidgetHostView::SelectionChanged(text, offset, range);
- // TODO(anicolao): deal with the clipboard without GTK
- NOTIMPLEMENTED();
-}
-
-void RenderWidgetHostViewViews::SelectionBoundsChanged(
- const gfx::Rect& start_rect,
- const gfx::Rect& end_rect) {
- views::InputMethod* input_method = GetInputMethod();
-
- if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect)
- return;
-
- selection_start_rect_ = start_rect;
- selection_end_rect_ = end_rect;
-
- if (input_method)
- input_method->OnCaretBoundsChanged(this);
-
- // TODO(sad): This is a workaround for a webkit bug:
- // https://bugs.webkit.org/show_bug.cgi?id=67464
- // Remove this when the bug gets fixed.
- //
- // Webkit can send spurious selection-change on text-input (e.g. when
- // inserting text at the beginning of a non-empty text control). But in those
- // cases, it does send the correct selection information quickly afterwards.
- // So delay the notification to the touch-selection controller.
- if (!weak_factory_.HasWeakPtrs()) {
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- base::Bind(
- &RenderWidgetHostViewViews::UpdateTouchSelectionController,
- weak_factory_.GetWeakPtr()),
- kTouchControllerUpdateDelay);
- }
-}
-
-void RenderWidgetHostViewViews::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
-#if defined(TOUCH_UI)
- if (type != chrome::NOTIFICATION_KEYBOARD_VISIBLE_BOUNDS_CHANGED) {
- NOTREACHED();
- return;
- }
-
- if (!GetWidget())
- return;
-
- gfx::Rect keyboard_rect = *content::Details<gfx::Rect>(details).ptr();
- if (keyboard_rect != keyboard_rect_) {
- keyboard_rect_ = keyboard_rect;
- gfx::Rect screen_bounds = GetScreenBounds();
- gfx::Rect intersecting_rect = screen_bounds.Intersect(keyboard_rect);
- gfx::Rect available_rect = screen_bounds.Subtract(intersecting_rect);
-
- // Convert available rect to window (RWHVV) coordinates.
- gfx::Point origin = available_rect.origin();
- gfx::Rect r = GetWidget()->GetClientAreaScreenBounds();
- origin.SetPoint(origin.x() - r.x(), origin.y() - r.y());
- views::View::ConvertPointFromWidget(this, &origin);
- available_rect.set_origin(origin);
- if (!available_rect.IsEmpty())
- host_->ScrollFocusedEditableNodeIntoRect(available_rect);
- }
-#endif
-}
-
-void RenderWidgetHostViewViews::ShowingContextMenu(bool showing) {
- is_showing_context_menu_ = showing;
-}
-
-BackingStore* RenderWidgetHostViewViews::AllocBackingStore(
- const gfx::Size& size) {
- return new BackingStoreSkia(host_, size);
-}
-
-void RenderWidgetHostViewViews::OnAcceleratedCompositingStateChange() {
-#if defined(TOOLKIT_USES_GTK)
- bool activated = host_->is_accelerated_compositing_active();
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- // If we don't use a views compositor, we currently have no way of
- // supporting rendering via the GPU process.
- if (!get_use_acceleration_when_possible() && activated)
- NOTREACHED();
-#else
- if (activated)
- NOTIMPLEMENTED();
-#endif
-#endif
-}
-
-void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) {
- RenderWidgetHostView::SetBackground(background);
- if (host_)
- host_->SetBackground(background);
-}
-
-void RenderWidgetHostViewViews::SetVisuallyDeemphasized(
- const SkColor* color, bool animate) {
- // TODO(anicolao)
-}
-
-void RenderWidgetHostViewViews::UnhandledWheelEvent(
- const WebKit::WebMouseWheelEvent& event) {
-}
-
-void RenderWidgetHostViewViews::SetHasHorizontalScrollbar(
- bool has_horizontal_scrollbar) {
-}
-
-void RenderWidgetHostViewViews::SetScrollOffsetPinning(
- bool is_pinned_to_left, bool is_pinned_to_right) {
-}
-
-bool RenderWidgetHostViewViews::LockMouse() {
- NOTIMPLEMENTED();
- return false;
-}
-
-void RenderWidgetHostViewViews::UnlockMouse() {
- NOTIMPLEMENTED();
-}
-
-void RenderWidgetHostViewViews::SelectRect(const gfx::Point& start,
- const gfx::Point& end) {
- if (host_)
- host_->SelectRange(start, end);
-}
-
-bool RenderWidgetHostViewViews::IsCommandIdChecked(int command_id) const {
- NOTREACHED();
- return true;
-}
-
-bool RenderWidgetHostViewViews::IsCommandIdEnabled(int command_id) const {
- bool editable = GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE;
- bool has_selection = !selection_range_.is_empty();
- string16 result;
- switch (command_id) {
- case IDS_APP_CUT:
- return editable && has_selection;
- case IDS_APP_COPY:
- return has_selection;
- case IDS_APP_PASTE:
- views::ViewsDelegate::views_delegate->GetClipboard()->
- ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
- return editable && !result.empty();
- case IDS_APP_DELETE:
- return editable && has_selection;
- case IDS_APP_SELECT_ALL:
- return true;
- default:
- NOTREACHED();
- return false;
- }
- return true;
-}
-
-bool RenderWidgetHostViewViews::GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) {
- NOTREACHED();
- return true;
-}
-
-void RenderWidgetHostViewViews::ExecuteCommand(int command_id) {
- switch (command_id) {
- case IDS_APP_CUT:
- host_->Cut();
- break;
- case IDS_APP_COPY:
- host_->Copy();
- break;
- case IDS_APP_PASTE:
- host_->Paste();
- break;
- case IDS_APP_DELETE:
- host_->Delete();
- break;
- case IDS_APP_SELECT_ALL:
- host_->SelectAll();
- break;
- default:
- NOTREACHED();
- }
-}
-
-std::string RenderWidgetHostViewViews::GetClassName() const {
- return kViewClassName;
-}
-
-gfx::NativeCursor RenderWidgetHostViewViews::GetCursor(
- const views::MouseEvent& event) {
- return native_cursor_;
-}
-
-bool RenderWidgetHostViewViews::OnMousePressed(const views::MouseEvent& event) {
- // The special buttons on a mouse (e.g. back, forward etc.) are not correctly
- // recognized by views Events. Ignore those events here, so that the event
- // bubbles up the view hierarchy and the appropriate parent view can handle
- // them.
- if (!(event.flags() & (ui::EF_LEFT_BUTTON_DOWN |
- ui::EF_RIGHT_BUTTON_DOWN |
- ui::EF_MIDDLE_BUTTON_DOWN))) {
- return false;
- }
-
- if (!host_)
- return false;
-
- RequestFocus();
-
- // Confirm existing composition text on mouse click events, to make sure
- // the input caret won't be moved with an ongoing composition text.
- FinishImeCompositionSession();
-
- // TODO(anicolao): validate event generation.
- WebKit::WebMouseEvent e = WebMouseEventFromViewsEvent(event);
-
- // TODO(anicolao): deal with double clicks
- e.type = WebKit::WebInputEvent::MouseDown;
- e.clickCount = 1;
-
- host_->ForwardMouseEvent(e);
- return true;
-}
-
-bool RenderWidgetHostViewViews::OnMouseDragged(const views::MouseEvent& event) {
- OnMouseMoved(event);
- return true;
-}
-
-void RenderWidgetHostViewViews::OnMouseReleased(
- const views::MouseEvent& event) {
- if (!(event.flags() & (ui::EF_LEFT_BUTTON_DOWN |
- ui::EF_RIGHT_BUTTON_DOWN |
- ui::EF_MIDDLE_BUTTON_DOWN))) {
- return;
- }
-
- if (!host_)
- return;
-
- WebKit::WebMouseEvent e = WebMouseEventFromViewsEvent(event);
- e.type = WebKit::WebInputEvent::MouseUp;
- e.clickCount = 1;
- host_->ForwardMouseEvent(e);
-}
-
-void RenderWidgetHostViewViews::OnMouseMoved(const views::MouseEvent& event) {
- if (!host_)
- return;
-
- WebKit::WebMouseEvent e = WebMouseEventFromViewsEvent(event);
- e.type = WebKit::WebInputEvent::MouseMove;
- host_->ForwardMouseEvent(e);
-}
-
-void RenderWidgetHostViewViews::OnMouseEntered(const views::MouseEvent& event) {
- // Already generated synthetically by webkit.
-}
-
-void RenderWidgetHostViewViews::OnMouseExited(const views::MouseEvent& event) {
- // Already generated synthetically by webkit.
-}
-
-bool RenderWidgetHostViewViews::OnKeyPressed(const views::KeyEvent& event) {
- // TODO(suzhe): Support editor key bindings.
- if (!host_)
- return false;
- host_->ForwardKeyboardEvent(NativeWebKeyboardEventViews(event));
- return true;
-}
-
-bool RenderWidgetHostViewViews::OnKeyReleased(const views::KeyEvent& event) {
- if (!host_)
- return false;
- host_->ForwardKeyboardEvent(NativeWebKeyboardEventViews(event));
- return true;
-}
-
-bool RenderWidgetHostViewViews::OnMouseWheel(
- const views::MouseWheelEvent& event) {
- if (!host_)
- return false;
-
- WebMouseWheelEvent wmwe;
- InitializeWebMouseEventFromViewsEvent(event, GetMirroredPosition(), &wmwe);
-
- wmwe.type = WebKit::WebInputEvent::MouseWheel;
- wmwe.button = WebKit::WebMouseEvent::ButtonNone;
-
- // TODO(sadrul): How do we determine if it's a horizontal scroll?
- wmwe.deltaY = event.offset();
- wmwe.wheelTicksY = wmwe.deltaY > 0 ? 1 : -1;
-
- host_->ForwardWheelEvent(wmwe);
- return true;
-}
-
-ui::TextInputClient* RenderWidgetHostViewViews::GetTextInputClient() {
- return this;
-}
-
-bool RenderWidgetHostViewViews::GetTooltipText(const gfx::Point& p,
- string16* tooltip) const {
- if (tooltip_text_.length() == 0)
- return false;
- *tooltip = tooltip_text_;
- return true;
-}
-
-// ui::TextInputClient implementation -----------------------------------------
-void RenderWidgetHostViewViews::SetCompositionText(
- const ui::CompositionText& composition) {
- if (!host_)
- return;
-
- // ui::CompositionUnderline should be identical to
- // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely.
- COMPILE_ASSERT(sizeof(ui::CompositionUnderline) ==
- sizeof(WebKit::WebCompositionUnderline),
- ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff);
-
- // TODO(suzhe): convert both renderer_host and renderer to use
- // ui::CompositionText.
- const std::vector<WebKit::WebCompositionUnderline>& underlines =
- reinterpret_cast<const std::vector<WebKit::WebCompositionUnderline>&>(
- composition.underlines);
-
- // TODO(suzhe): due to a bug of webkit, we can't use selection range with
- // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
- host_->ImeSetComposition(composition.text, underlines,
- composition.selection.end(),
- composition.selection.end());
-
- has_composition_text_ = !composition.text.empty();
-}
-
-void RenderWidgetHostViewViews::ConfirmCompositionText() {
- if (host_ && has_composition_text_)
- host_->ImeConfirmComposition();
- has_composition_text_ = false;
-}
-
-void RenderWidgetHostViewViews::ClearCompositionText() {
- if (host_ && has_composition_text_)
- host_->ImeCancelComposition();
- has_composition_text_ = false;
-}
-
-void RenderWidgetHostViewViews::InsertText(const string16& text) {
- DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE);
- if (host_)
- host_->ImeConfirmComposition(text);
- has_composition_text_ = false;
-}
-
-void RenderWidgetHostViewViews::InsertChar(char16 ch, int flags) {
- if (host_) {
- NativeWebKeyboardEventViews::FromViewsEvent from_views_event;
- NativeWebKeyboardEventViews wke(ch, flags, base::Time::Now().ToDoubleT(),
- from_views_event);
- host_->ForwardKeyboardEvent(wke);
- }
-}
-
-ui::TextInputType RenderWidgetHostViewViews::GetTextInputType() const {
- return text_input_type_;
-}
-
-gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() {
- return selection_start_rect_.Union(selection_end_rect_);
-}
-
-bool RenderWidgetHostViewViews::HasCompositionText() {
- return has_composition_text_;
-}
-
-bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) {
- range->set_start(selection_text_offset_);
- range->set_end(selection_text_offset_ + selection_text_.length());
- return true;
-}
-
-bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) {
- // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
- NOTIMPLEMENTED();
- return false;
-}
-
-bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) {
- range->set_start(selection_range_.start());
- range->set_end(selection_range_.end());
- return true;
-}
-
-bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) {
- // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
- NOTIMPLEMENTED();
- return false;
-}
-
-bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) {
- // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
- NOTIMPLEMENTED();
- return false;
-}
-
-bool RenderWidgetHostViewViews::GetTextFromRange(
- const ui::Range& range,
- string16* text) {
- ui::Range selection_text_range(selection_text_offset_,
- selection_text_offset_ + selection_text_.length());
-
- if (!selection_text_range.Contains(range)) {
- text->clear();
- return false;
- }
- if (selection_text_range.EqualsIgnoringDirection(range)) {
- // Avoid calling substr which performance is low.
- *text = selection_text_;
- } else {
- *text = selection_text_.substr(
- range.GetMin() - selection_text_offset_,
- range.length());
- }
- return true;
-}
-
-void RenderWidgetHostViewViews::OnInputMethodChanged() {
- if (!host_)
- return;
-
- DCHECK(GetInputMethod());
- host_->SetInputMethodActive(GetInputMethod()->IsActive());
-
- // TODO(suzhe): implement the newly added “locale” property of HTML DOM
- // TextEvent.
-}
-
-bool RenderWidgetHostViewViews::ChangeTextDirectionAndLayoutAlignment(
- base::i18n::TextDirection direction) {
- if (!host_)
- return false;
- host_->UpdateTextDirection(
- direction == base::i18n::RIGHT_TO_LEFT ?
- WebKit::WebTextDirectionRightToLeft :
- WebKit::WebTextDirectionLeftToRight);
- host_->NotifyTextDirection();
- return true;
-}
-
-void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) {
- if (is_hidden_ || !host_)
- return;
-
- DCHECK(!host_->is_accelerated_compositing_active() ||
- get_use_acceleration_when_possible());
-
- // If we aren't using the views compositor, then
- // paint a "hole" in the canvas so that the render of the web page is on
- // top of whatever else has already been painted in the views hierarchy.
- // Later views might still get to paint on top.
- if (!get_use_acceleration_when_possible())
- canvas->FillRect(SK_ColorBLACK, GetLocalBounds(), SkXfermode::kClear_Mode);
-
- DCHECK(!about_to_validate_and_paint_);
-
- // TODO(anicolao): get the damage somehow
- // invalid_rect_ = damage_rect;
- invalid_rect_ = bounds();
- gfx::Point origin;
- ConvertPointToWidget(this, &origin);
-
- about_to_validate_and_paint_ = true;
- BackingStore* backing_store = host_->GetBackingStore(true);
- // Calling GetBackingStore maybe have changed |invalid_rect_|...
- about_to_validate_and_paint_ = false;
-
- gfx::Rect paint_rect = gfx::Rect(0, 0, kMaxWindowWidth, kMaxWindowHeight);
- paint_rect = paint_rect.Intersect(invalid_rect_);
-
- if (backing_store) {
-#if defined(TOOLKIT_USES_GTK)
- // Only render the widget if it is attached to a window; there's a short
- // period where this object isn't attached to a window but hasn't been
- // Destroy()ed yet and it receives paint messages...
- if (IsReadyToPaint()) {
-#endif
- if (!visually_deemphasized_) {
- // In the common case, use XCopyArea. We don't draw more than once, so
- // we don't need to double buffer.
- if (IsPopup()) {
- origin.SetPoint(origin.x() + paint_rect.x(),
- origin.y() + paint_rect.y());
- paint_rect.SetRect(0, 0, paint_rect.width(), paint_rect.height());
- }
- static_cast<BackingStoreSkia*>(backing_store)->SkiaShowRect(
- gfx::Point(paint_rect.x(), paint_rect.y()), canvas);
- } else {
- // TODO(sad)
- NOTIMPLEMENTED();
- }
-#if defined(TOOLKIT_USES_GTK)
- }
-#endif
- if (!whiteout_start_time_.is_null()) {
- base::TimeDelta whiteout_duration = base::TimeTicks::Now() -
- whiteout_start_time_;
- UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration);
-
- // Reset the start time to 0 so that we start recording again the next
- // time the backing store is NULL...
- whiteout_start_time_ = base::TimeTicks();
- }
- if (!tab_switch_paint_time_.is_null()) {
- base::TimeDelta tab_switch_paint_duration = base::TimeTicks::Now() -
- tab_switch_paint_time_;
- UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration",
- tab_switch_paint_duration);
- // Reset tab_switch_paint_time_ to 0 so future tab selections are
- // recorded.
- tab_switch_paint_time_ = base::TimeTicks();
- }
- } else {
- if (whiteout_start_time_.is_null())
- whiteout_start_time_ = base::TimeTicks::Now();
-
- if (get_use_acceleration_when_possible())
- canvas->FillRect(SK_ColorWHITE, GetLocalBounds());
- }
-}
-
-void RenderWidgetHostViewViews::Focus() {
- RequestFocus();
-}
-
-void RenderWidgetHostViewViews::Blur() {
- // TODO(estade): We should be clearing native focus as well, but I know of no
- // way to do that without focusing another widget.
- if (host_) {
- host_->SetActive(false);
- host_->Blur();
- }
-}
-
-void RenderWidgetHostViewViews::OnFocus() {
- if (!host_)
- return;
-
- DCHECK(GetInputMethod());
- View::OnFocus();
- ShowCurrentCursor();
- host_->GotFocus();
- host_->SetActive(true);
- host_->SetInputMethodActive(GetInputMethod()->IsActive());
-
- UpdateTouchSelectionController();
-}
-
-void RenderWidgetHostViewViews::OnBlur() {
- if (!host_)
- return;
- View::OnBlur();
- // If we are showing a context menu, maintain the illusion that webkit has
- // focus.
- if (!is_showing_context_menu_ && !is_hidden_)
- host_->Blur();
- host_->SetInputMethodActive(false);
-
- if (touch_selection_controller_.get())
- touch_selection_controller_->ClientViewLostFocus();
-}
-
-bool RenderWidgetHostViewViews::NeedsInputGrab() {
- return popup_type_ == WebKit::WebPopupTypeSelect;
-}
-
-bool RenderWidgetHostViewViews::IsPopup() {
- return popup_type_ != WebKit::WebPopupTypeNone;
-}
-
-WebKit::WebMouseEvent RenderWidgetHostViewViews::WebMouseEventFromViewsEvent(
- const views::MouseEvent& event) {
- WebKit::WebMouseEvent wmevent;
- InitializeWebMouseEventFromViewsEvent(event, GetMirroredPosition(), &wmevent);
-
- // Setting |wmevent.button| is not necessary for -move events, but it is
- // necessary for -clicks and -drags.
- if (event.IsMiddleMouseButton()) {
- wmevent.modifiers |= WebKit::WebInputEvent::MiddleButtonDown;
- wmevent.button = WebKit::WebMouseEvent::ButtonMiddle;
- }
- if (event.IsRightMouseButton()) {
- wmevent.modifiers |= WebKit::WebInputEvent::RightButtonDown;
- wmevent.button = WebKit::WebMouseEvent::ButtonRight;
- }
- if (event.IsLeftMouseButton()) {
- wmevent.modifiers |= WebKit::WebInputEvent::LeftButtonDown;
- wmevent.button = WebKit::WebMouseEvent::ButtonLeft;
- }
-
- return wmevent;
-}
-
-void RenderWidgetHostViewViews::FinishImeCompositionSession() {
- if (!has_composition_text_)
- return;
- if (host_)
- host_->ImeConfirmComposition();
- DCHECK(GetInputMethod());
- GetInputMethod()->CancelComposition(this);
- has_composition_text_ = false;
-}
-
-void RenderWidgetHostViewViews::UpdateTouchSelectionController() {
- gfx::Point start = selection_start_rect_.origin();
- start.Offset(0, selection_start_rect_.height());
- gfx::Point end = selection_end_rect_.origin();
- end.Offset(0, selection_end_rect_.height());
-
- if (touch_selection_controller_.get())
- touch_selection_controller_->SelectionChanged(start, end);
-}
-
-#if !defined(OS_WIN)
-void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) {
- // Optimize the common case, where the cursor hasn't changed.
- // However, we can switch between different pixmaps, so only on the
- // non-pixmap branch.
-#if defined(TOOLKIT_USES_GTK)
- if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP &&
- current_cursor_.GetCursorType() == cursor.GetCursorType()) {
- return;
- }
-#endif
- current_cursor_ = cursor;
- ShowCurrentCursor();
-}
-
-void RenderWidgetHostViewViews::ShowCurrentCursor() {
-#if !defined(USE_AURA)
- // The widget may not have a window. If that's the case, abort mission. This
- // is the same issue as that explained above in Paint().
- if (!IsReadyToPaint())
- return;
-#endif
-
- native_cursor_ = current_cursor_.GetNativeCursor();
-}
-
-#if defined(TOOLKIT_USES_GTK)
-bool RenderWidgetHostViewViews::IsReadyToPaint() {
- views::Widget* top = NULL;
-
- // TODO(oshima): move this functionality to Widget.
- if (views::ViewsDelegate::views_delegate &&
- views::ViewsDelegate::views_delegate->GetDefaultParentView()) {
- top = views::ViewsDelegate::views_delegate->GetDefaultParentView()->
- GetWidget();
- } else {
- // Use GetTopLevelWidget()'s native view to get platform
- // native widget. This is a workaround to get window's NativeWidgetGtk
- // under both views desktop (where toplevel is NativeWidgetViews,
- // whose GetNativeView returns gtk widget of the native window)
- // and non views desktop (where toplevel is NativeWidgetGtk).
- top = GetWidget() ?
- views::Widget::GetWidgetForNativeView(
- GetWidget()->GetTopLevelWidget()->GetNativeView()) :
- NULL;
- }
-
- return top ?
- !!(static_cast<const views::NativeWidgetGtk*>(top->native_widget())->
- window_contents()->window) : false;
-}
-#endif
-
-#endif // !OS_WIN
-
-#if defined(TOOLKIT_USES_GTK)
-void RenderWidgetHostViewViews::CreatePluginContainer(
- gfx::PluginWindowHandle id) {
- // TODO(anicolao): plugin_container_manager_.CreatePluginContainer(id);
-}
-
-void RenderWidgetHostViewViews::DestroyPluginContainer(
- gfx::PluginWindowHandle id) {
- // TODO(anicolao): plugin_container_manager_.DestroyPluginContainer(id);
-}
-
-#endif // TOOLKIT_USES_GTK
-
-#if defined(OS_POSIX) || defined(USE_AURA)
-void RenderWidgetHostViewViews::GetDefaultScreenInfo(
- WebKit::WebScreenInfo* results) {
- NOTIMPLEMENTED();
-}
-
-void RenderWidgetHostViewViews::GetScreenInfo(WebKit::WebScreenInfo* results) {
-#if !defined(USE_AURA)
- views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL;
- if (widget && widget->GetNativeView())
- content::GetScreenInfoFromNativeWindow(widget->GetNativeView()->window,
- results);
- else
- RenderWidgetHostView::GetDefaultScreenInfo(results);
-#else
- RenderWidgetHostView::GetDefaultScreenInfo(results);
-#endif
-}
-
-gfx::Rect RenderWidgetHostViewViews::GetRootWindowBounds() {
- views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL;
- return widget ? widget->GetWindowScreenBounds() : gfx::Rect();
-}
-#endif
-
-#if !defined(OS_WIN) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
-gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
- // TODO(oshima): The original implementation was broken as
- // GtkNativeViewManager doesn't know about NativeWidgetGtk. Figure
- // out if this makes sense without compositor. If it does, then find
- // out the right way to handle.
- NOTIMPLEMENTED();
- return gfx::kNullPluginWindow;
-}
-#endif
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
-gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
- // On TOUCH_UI builds, the GPU process renders to an offscreen surface
- // (created by the GPU process), which is later displayed by the browser.
- // As the GPU process creates this surface, we can return any non-zero value.
- return 1;
-}
-
-void RenderWidgetHostViewViews::AcceleratedSurfaceNew(
- int32 width,
- int32 height,
- uint64* surface_id,
- TransportDIB::Handle* surface_handle) {
- scoped_refptr<AcceleratedSurfaceContainerLinux> surface(
- AcceleratedSurfaceContainerLinux::Create(gfx::Size(width, height)));
- if (!surface->Initialize(surface_id)) {
- LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer";
- return;
- }
- *surface_handle = surface->Handle();
-
- accelerated_surface_containers_[*surface_id] = surface;
-}
-
-void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) {
- accelerated_surface_containers_.erase(surface_id);
-}
-
-void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped(
- uint64 surface_id,
- int32 route_id,
- int gpu_host_id) {
- SetExternalTexture(accelerated_surface_containers_[surface_id]->GetTexture());
- glFlush();
-
- if (!GetWidget() || !GetWidget()->GetCompositor()) {
- // We have no compositor, so we have no way to display the surface.
- // Must still send the ACK.
- host_->AcknowledgeSwapBuffers(route_id, gpu_host_id);
- } else {
- // Add sending an ACK to the list of things to do OnCompositingEnded
- on_compositing_ended_callbacks_.push_back(
- base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers,
- base::Unretained(host_), route_id, gpu_host_id));
- ui::Compositor *compositor = GetWidget()->GetCompositor();
- if (!compositor->HasObserver(this))
- compositor->AddObserver(this);
- }
-}
-
-void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) {
- for (std::vector< base::Callback<void(void)> >::const_iterator
- it = on_compositing_ended_callbacks_.begin();
- it != on_compositing_ended_callbacks_.end(); ++it) {
- it->Run();
- }
- on_compositing_ended_callbacks_.clear();
- compositor->RemoveObserver(this);
-}
-
-#endif
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.h b/chrome/browser/renderer_host/render_widget_host_view_views.h
deleted file mode 100644
index d3f400d..0000000
--- a/chrome/browser/renderer_host/render_widget_host_view_views.h
+++ /dev/null
@@ -1,319 +0,0 @@
-// Copyright (c) 2011 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_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_
-#define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_
-#pragma once
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/string16.h"
-#include "base/time.h"
-#include "content/browser/renderer_host/render_widget_host_view.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-#include "ui/base/ime/text_input_client.h"
-#include "ui/gfx/compositor/compositor_observer.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/views/events/event.h"
-#include "ui/views/touchui/touch_selection_controller.h"
-#include "views/controls/native/native_view_host.h"
-#include "views/view.h"
-#include "webkit/glue/webcursor.h"
-
-#if defined(TOUCH_UI)
-namespace ui {
-enum TouchStatus;
-}
-#endif
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
-class AcceleratedSurfaceContainerLinux;
-#endif
-
-class RenderWidgetHost;
-
-// -----------------------------------------------------------------------------
-// See comments in render_widget_host_view.h about this class and its members.
-// -----------------------------------------------------------------------------
-class RenderWidgetHostViewViews : public RenderWidgetHostView,
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- public ui::CompositorObserver,
-#endif
- public views::TouchSelectionClientView,
- public ui::TextInputClient,
- public content::NotificationObserver {
- public:
- // Internal class name.
- static const char kViewClassName[];
-
- explicit RenderWidgetHostViewViews(RenderWidgetHost* widget);
- virtual ~RenderWidgetHostViewViews();
-
- // Initialize this object for use as a drawing area.
- void InitAsChild();
-
- // RenderWidgetHostView implementation.
- virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
- const gfx::Rect& pos) OVERRIDE;
- virtual void InitAsFullscreen(
- RenderWidgetHostView* reference_host_view) OVERRIDE;
- virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
- virtual void DidBecomeSelected() OVERRIDE;
- virtual void WasHidden() OVERRIDE;
- virtual void SetSize(const gfx::Size& size) OVERRIDE;
- virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
- virtual gfx::NativeView GetNativeView() const OVERRIDE;
- virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
- virtual void MovePluginWindows(
- const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE;
- virtual bool HasFocus() const OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual bool IsShowing() OVERRIDE;
- virtual gfx::Rect GetViewBounds() const OVERRIDE;
- virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
- virtual void SetIsLoading(bool is_loading) OVERRIDE;
- virtual void TextInputStateChanged(ui::TextInputType type,
- bool can_compose_inline) OVERRIDE;
- virtual void ImeCancelComposition() OVERRIDE;
- virtual void DidUpdateBackingStore(
- const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
- const std::vector<gfx::Rect>& copy_rects) OVERRIDE;
- virtual void RenderViewGone(base::TerminationStatus status,
- int error_code) OVERRIDE;
- virtual void Destroy() OVERRIDE;
- virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE;
- virtual void SelectionChanged(const string16& text,
- size_t offset,
- const ui::Range& range) OVERRIDE;
- virtual void SelectionBoundsChanged(const gfx::Rect& start_rect,
- const gfx::Rect& end_rect) OVERRIDE;
- virtual void ShowingContextMenu(bool showing) OVERRIDE;
- virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
- virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
- virtual void SetBackground(const SkBitmap& background) OVERRIDE;
-#if defined(OS_POSIX) || defined(USE_AURA)
- virtual void GetDefaultScreenInfo(WebKit::WebScreenInfo* results);
- virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
- virtual gfx::Rect GetRootWindowBounds() OVERRIDE;
-#endif
-#if defined(TOOLKIT_USES_GTK)
- virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE;
- virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE;
-#endif
- virtual void SetVisuallyDeemphasized(const SkColor* color,
- bool animate) OVERRIDE;
- virtual void UnhandledWheelEvent(
- const WebKit::WebMouseWheelEvent& event) OVERRIDE;
- virtual void SetHasHorizontalScrollbar(
- bool has_horizontal_scrollbar) OVERRIDE;
- virtual void SetScrollOffsetPinning(
- bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
-#if defined(OS_WIN) && !defined(USE_AURA)
- virtual void WillWmDestroy() OVERRIDE;
-#endif
- virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
- virtual bool LockMouse() OVERRIDE;
- virtual void UnlockMouse() OVERRIDE;
-
- // Overridden from views::TouchSelectionClientView.
- virtual void SelectRect(const gfx::Point& start,
- const gfx::Point& end) OVERRIDE;
-
- // Overriden from content::NotificationObserver
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- // Overridden from ui::SimpleMenuModel::Delegate.
- virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
- virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) OVERRIDE;
- virtual void ExecuteCommand(int command_id) OVERRIDE;
-
- // Overridden from views::View.
- virtual std::string GetClassName() const OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE;
- virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
- virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
- virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
- virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE;
- virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
- virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
-#if defined(TOUCH_UI)
- virtual ui::TouchStatus OnTouchEvent(const views::TouchEvent& event) OVERRIDE;
-#endif
- virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE;
- virtual bool OnKeyReleased(const views::KeyEvent& event) OVERRIDE;
- virtual bool OnMouseWheel(const views::MouseWheelEvent& event) OVERRIDE;
- virtual ui::TextInputClient* GetTextInputClient() OVERRIDE;
- virtual bool GetTooltipText(const gfx::Point& p,
- string16* tooltip) const OVERRIDE;
-
- // Overridden from ui::TextInputClient:
- virtual void SetCompositionText(
- const ui::CompositionText& composition) OVERRIDE;
- virtual void ConfirmCompositionText() OVERRIDE;
- virtual void ClearCompositionText() OVERRIDE;
- virtual void InsertText(const string16& text) OVERRIDE;
- virtual void InsertChar(char16 ch, int flags) OVERRIDE;
- virtual ui::TextInputType GetTextInputType() const OVERRIDE;
- virtual gfx::Rect GetCaretBounds() OVERRIDE;
- virtual bool HasCompositionText() OVERRIDE;
- virtual bool GetTextRange(ui::Range* range) OVERRIDE;
- virtual bool GetCompositionTextRange(ui::Range* range) OVERRIDE;
- virtual bool GetSelectionRange(ui::Range* range) OVERRIDE;
- virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE;
- virtual bool DeleteRange(const ui::Range& range) OVERRIDE;
- virtual bool GetTextFromRange(const ui::Range& range,
- string16* text) OVERRIDE;
- virtual void OnInputMethodChanged() OVERRIDE;
- virtual bool ChangeTextDirectionAndLayoutAlignment(
- base::i18n::TextDirection direction) OVERRIDE;
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- virtual void AcceleratedSurfaceNew(
- int32 width,
- int32 height,
- uint64* surface_id,
- TransportDIB::Handle* surface_handle) OVERRIDE;
- virtual void AcceleratedSurfaceBuffersSwapped(
- uint64 surface_id,
- int32 route_id,
- int gpu_host_id) OVERRIDE;
- virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE;
-
- // CompositorObserver implementation:
- virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE;
-#endif
-
- protected:
- // Overridden from views::View.
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
- virtual void OnFocus() OVERRIDE;
- virtual void OnBlur() OVERRIDE;
-
- // Overridden from RenderWidgetHostView
- virtual void Focus() OVERRIDE;
- virtual void Blur() OVERRIDE;
-
- private:
- friend class RenderWidgetHostViewViewsWidget;
-
- // Returns whether the widget needs an input grab to work
- // properly.
- bool NeedsInputGrab();
-
- // Returns whether this render view is a popup (<select> dropdown or
- // autocomplete window).
- bool IsPopup();
-
- // Update the display cursor for the render view.
- void ShowCurrentCursor();
-
- // Translate a views::MouseEvent into a WebKit::WebMouseEvent.
- WebKit::WebMouseEvent WebMouseEventFromViewsEvent(
- const views::MouseEvent& event);
-
- // Confirm existing composition text in the webpage and ask the input method
- // to cancel its ongoing composition sesstion.
- void FinishImeCompositionSession();
-
- // Updates the touch-selection controller (e.g. when the selection/focus
- // changes).
- void UpdateTouchSelectionController();
-
-#if defined(TOOLKIT_USES_GTK)
- // Returns true if the RWHV is ready to paint the content.
- bool IsReadyToPaint();
-#endif
-
- // The model object.
- RenderWidgetHost* host_;
-
- // This is true when we are currently painting and thus should handle extra
- // paint requests by expanding the invalid rect rather than actually
- // painting.
- bool about_to_validate_and_paint_;
-
- // This is the rectangle which we'll paint.
- gfx::Rect invalid_rect_;
-
- // Whether or not this widget is hidden.
- bool is_hidden_;
-
- // Whether we are currently loading.
- bool is_loading_;
-
- // The cursor for the page. This is passed up from the renderer.
- WebCursor current_cursor_;
-
- // The native cursor.
- gfx::NativeCursor native_cursor_;
-
- // Whether we are showing a context menu.
- bool is_showing_context_menu_;
-
- // The time at which this view started displaying white pixels as a result of
- // not having anything to paint (empty backing store from renderer). This
- // value returns true for is_null() if we are not recording whiteout times.
- base::TimeTicks whiteout_start_time_;
-
- // The time it took after this view was selected for it to be fully painted.
- base::TimeTicks tab_switch_paint_time_;
-
- // If true, fade the render widget when painting it.
- bool visually_deemphasized_;
-
- // The size that we want the renderer to be.
- gfx::Size requested_size_;
-
- // The touch-event. Its touch-points are updated as necessary. A new
- // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
- // removed from the list on an ET_TOUCH_RELEASED event.
- WebKit::WebTouchEvent touch_event_;
-
- // The current text input type.
- ui::TextInputType text_input_type_;
-
- // Rectangles before and after the selection.
- gfx::Rect selection_start_rect_;
- gfx::Rect selection_end_rect_;
-
- // Indicates if there is onging composition text.
- bool has_composition_text_;
-
- string16 tooltip_text_;
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_;
-#endif
-
- scoped_ptr<views::TouchSelectionController> touch_selection_controller_;
- base::WeakPtrFactory<RenderWidgetHostViewViews> weak_factory_;
-
-#if defined(TOUCH_UI)
- // used to register for keyboard visiblity notificatons.
- content::NotificationRegistrar registrar_;
- gfx::Rect keyboard_rect_;
-#endif
-
-#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
- std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerLinux> >
- accelerated_surface_containers_;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewViews);
-};
-
-#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc b/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc
deleted file mode 100644
index f497f17..0000000
--- a/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) 2011 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/renderer_host/render_widget_host_view_views.h"
-
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-#include "base/logging.h"
-#include "content/browser/renderer_host/gtk_window_utils.h"
-#include "content/browser/renderer_host/render_widget_host.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
-#include "views/widget/widget.h"
-
-static const char kRenderWidgetHostViewKey[] = "__RENDER_WIDGET_HOST_VIEW__";
-
-using WebKit::WebInputEventFactory;
-using WebKit::WebTouchEvent;
-
-namespace {
-
-WebKit::WebTouchPoint::State TouchPointStateFromEvent(
- const views::TouchEvent* event) {
- switch (event->type()) {
- case ui::ET_TOUCH_PRESSED:
- return WebKit::WebTouchPoint::StatePressed;
- case ui::ET_TOUCH_RELEASED:
- return WebKit::WebTouchPoint::StateReleased;
- case ui::ET_TOUCH_MOVED:
- return WebKit::WebTouchPoint::StateMoved;
- case ui::ET_TOUCH_CANCELLED:
- return WebKit::WebTouchPoint::StateCancelled;
- default:
- return WebKit::WebTouchPoint::StateUndefined;
- }
-}
-
-WebKit::WebInputEvent::Type TouchEventTypeFromEvent(
- const views::TouchEvent* event) {
- switch (event->type()) {
- case ui::ET_TOUCH_PRESSED:
- return WebKit::WebInputEvent::TouchStart;
- case ui::ET_TOUCH_RELEASED:
- return WebKit::WebInputEvent::TouchEnd;
- case ui::ET_TOUCH_MOVED:
- return WebKit::WebInputEvent::TouchMove;
- case ui::ET_TOUCH_CANCELLED:
- return WebKit::WebInputEvent::TouchCancel;
- default:
- return WebKit::WebInputEvent::Undefined;
- }
-}
-
-inline void UpdateTouchParams(const views::TouchEvent& event,
- WebKit::WebTouchPoint* tpoint) {
- tpoint->radiusX = event.radius_x();
- tpoint->radiusY = event.radius_y();
- tpoint->rotationAngle = event.rotation_angle();
- tpoint->force = event.force();
-}
-
-void UpdateTouchPointPosition(const views::TouchEvent* event,
- const gfx::Point& origin,
- WebKit::WebTouchPoint* tpoint) {
- tpoint->position.x = event->x();
- tpoint->position.y = event->y();
-
- tpoint->screenPosition.x = tpoint->position.x + origin.x();
- tpoint->screenPosition.y = tpoint->position.y + origin.y();
-}
-
-} // namespace
-
-ui::TouchStatus RenderWidgetHostViewViews::OnTouchEvent(
- const views::TouchEvent& event) {
- if (!host_)
- return ui::TOUCH_STATUS_UNKNOWN;
-
- // Update the list of touch points first.
- WebKit::WebTouchPoint* point = NULL;
- ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN;
-
- switch (event.type()) {
- case ui::ET_TOUCH_PRESSED:
- // Add a new touch point.
- if (touch_event_.touchesLength <
- WebTouchEvent::touchesLengthCap) {
- point = &touch_event_.touches[touch_event_.touchesLength++];
- point->id = event.identity();
-
- if (touch_event_.touchesLength == 1) {
- // A new touch sequence has started.
- status = ui::TOUCH_STATUS_START;
-
- // We also want the focus.
- RequestFocus();
-
- // Confirm existing composition text on touch press events, to make
- // sure the input caret won't be moved with an ongoing composition
- // text.
- FinishImeCompositionSession();
- }
- }
- break;
- case ui::ET_TOUCH_RELEASED:
- case ui::ET_TOUCH_CANCELLED:
- case ui::ET_TOUCH_MOVED: {
- // The touch point should have been added to the event from an earlier
- // _PRESSED event. So find that.
- // At the moment, only a maximum of 4 touch-points are allowed. So a
- // simple loop should be sufficient.
- for (unsigned i = 0; i < touch_event_.touchesLength; ++i) {
- point = touch_event_.touches + i;
- if (point->id == event.identity()) {
- break;
- }
- point = NULL;
- }
- break;
- }
- default:
- DLOG(WARNING) << "Unknown touch event " << event.type();
- break;
- }
-
- if (!point)
- return ui::TOUCH_STATUS_UNKNOWN;
-
- if (status != ui::TOUCH_STATUS_START)
- status = ui::TOUCH_STATUS_CONTINUE;
-
- UpdateTouchParams(event, point);
-
- // Update the location and state of the point.
- point->state = TouchPointStateFromEvent(&event);
- if (point->state == WebKit::WebTouchPoint::StateMoved) {
- // It is possible for badly written touch drivers to emit Move events even
- // when the touch location hasn't changed. In such cases, consume the event
- // and pretend nothing happened.
- if (point->position.x == event.x() && point->position.y == event.y()) {
- return status;
- }
- }
- UpdateTouchPointPosition(&event, GetMirroredPosition(), point);
-
- // Mark the rest of the points as stationary.
- for (unsigned i = 0; i < touch_event_.touchesLength; ++i) {
- WebKit::WebTouchPoint* iter = touch_event_.touches + i;
- if (iter != point) {
- iter->state = WebKit::WebTouchPoint::StateStationary;
- }
- }
-
- // Update the type of the touch event.
- touch_event_.type = TouchEventTypeFromEvent(&event);
- touch_event_.timeStampSeconds = base::Time::Now().ToDoubleT();
-
- // The event and all the touches have been updated. Dispatch.
- host_->ForwardTouchEvent(touch_event_);
-
- // If the touch was released, then remove it from the list of touch points.
- if (event.type() == ui::ET_TOUCH_RELEASED) {
- --touch_event_.touchesLength;
- for (unsigned i = point - touch_event_.touches;
- i < touch_event_.touchesLength;
- ++i) {
- touch_event_.touches[i] = touch_event_.touches[i + 1];
- }
- if (touch_event_.touchesLength == 0)
- status = ui::TOUCH_STATUS_END;
- } else if (event.type() == ui::ET_TOUCH_CANCELLED) {
- status = ui::TOUCH_STATUS_CANCEL;
- }
-
- return status;
-}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views_win.cc b/chrome/browser/renderer_host/render_widget_host_view_views_win.cc
deleted file mode 100644
index ecb05ea..0000000
--- a/chrome/browser/renderer_host/render_widget_host_view_views_win.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 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/renderer_host/render_widget_host_view_views.h"
-
-#include "base/logging.h"
-#include "views/widget/widget.h"
-
-void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) {
-}
-
-#if !defined(USE_AURA)
-void RenderWidgetHostViewViews::WillWmDestroy() {
- NOTIMPLEMENTED();
-}
-#endif
-
-gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
- NOTIMPLEMENTED();
- return NULL;
-}
-
-void RenderWidgetHostViewViews::ShowCurrentCursor() {
- NOTIMPLEMENTED();
-}
diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
index e80c3c1..9d77a53 100644
--- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
+++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
@@ -31,7 +31,6 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate {
// Overridden from views::ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const OVERRIDE { return NULL; }
- virtual views::View* GetDefaultParentView() OVERRIDE { return NULL; }
virtual void SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index 9dfc225..40cfe9a 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -75,7 +75,6 @@ class ViewsDelegateImpl : public views::ViewsDelegate {
public:
ViewsDelegateImpl() {}
virtual ui::Clipboard* GetClipboard() const OVERRIDE { return NULL; }
- virtual views::View* GetDefaultParentView() OVERRIDE { return NULL; }
virtual void SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc
index f75d657..8691fd7 100644
--- a/chrome/browser/ui/views/bubble/bubble.cc
+++ b/chrome/browser/ui/views/bubble/bubble.cc
@@ -133,8 +133,6 @@ Bubble::Bubble()
views::NativeWidgetAura(new views::Widget),
#elif defined(OS_WIN)
views::NativeWidgetWin(new views::Widget),
-#elif defined(TOUCH_UI)
- views::NativeWidgetViews(new views::Widget),
#elif defined(TOOLKIT_USES_GTK)
views::NativeWidgetGtk(new views::Widget),
#endif
@@ -163,8 +161,6 @@ Bubble::Bubble(views::Widget::InitParams::Type type,
bool show_while_screen_is_locked)
#if defined(USE_AURA)
: views::NativeWidgetAura(new views::Widget),
-#elif defined(TOUCH_UI)
- : views::NativeWidgetViews(new views::Widget),
#else
: views::NativeWidgetGtk(new views::Widget),
#endif
@@ -404,8 +400,6 @@ void Bubble::DoClose(bool closed_by_escape) {
NativeWidgetAura::Close();
#elif defined(OS_WIN)
NativeWidgetWin::Close();
-#elif defined(TOUCH_UI)
- NativeWidgetViews::Close();
#elif defined(TOOLKIT_USES_GTK)
NativeWidgetGtk::Close();
#endif
diff --git a/chrome/browser/ui/views/bubble/bubble.h b/chrome/browser/ui/views/bubble/bubble.h
index 8a56781..0a045f15 100644
--- a/chrome/browser/ui/views/bubble/bubble.h
+++ b/chrome/browser/ui/views/bubble/bubble.h
@@ -16,8 +16,6 @@
#include "views/widget/native_widget_aura.h"
#elif defined(OS_WIN)
#include "views/widget/native_widget_win.h"
-#elif defined(TOUCH_UI)
-#include "views/widget/native_widget_views.h"
#elif defined(TOOLKIT_USES_GTK)
#include "views/widget/native_widget_gtk.h"
#endif
@@ -78,8 +76,6 @@ class Bubble
: public views::NativeWidgetAura,
#elif defined(OS_WIN)
: public views::NativeWidgetWin,
-#elif defined(TOUCH_UI)
- : public views::NativeWidgetViews,
#elif defined(TOOLKIT_USES_GTK)
: public views::NativeWidgetGtk,
#endif
@@ -193,9 +189,6 @@ class Bubble
#elif defined(OS_WIN)
// Overridden from NativeWidgetWin:
virtual void OnActivate(UINT action, BOOL minimized, HWND window);
-#elif defined(TOUCH_UI)
- // Overridden from NativeWidgetViews::
- virtual void Deactivate() OVERRIDE;
#elif defined(TOOLKIT_USES_GTK)
// Overridden from NativeWidgetGtk:
virtual void OnActiveChanged() OVERRIDE;
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index cbbd7f3..4072dab 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -44,9 +44,6 @@ PrefService* GetPrefsForWindow(const views::Widget* window) {
} // namespace
-// static
-views::View* ChromeViewsDelegate::default_parent_view = NULL;
-
///////////////////////////////////////////////////////////////////////////////
// ChromeViewsDelegate, views::ViewsDelegate implementation:
@@ -54,10 +51,6 @@ ui::Clipboard* ChromeViewsDelegate::GetClipboard() const {
return g_browser_process->clipboard();
}
-views::View* ChromeViewsDelegate::GetDefaultParentView() {
- return default_parent_view;
-}
-
void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h
index 1b223e3..bad2b70 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.h
+++ b/chrome/browser/ui/views/chrome_views_delegate.h
@@ -14,14 +14,11 @@
class ChromeViewsDelegate : public views::ViewsDelegate {
public:
- static views::View* default_parent_view;
-
ChromeViewsDelegate() {}
virtual ~ChromeViewsDelegate() {}
// Overridden from views::ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const OVERRIDE;
- virtual views::View* GetDefaultParentView() OVERRIDE;
virtual void SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index 584c7f8..6e19fb8 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -607,20 +607,8 @@ ConstrainedWindowViews::ConstrainedWindowViews(
views::Widget::InitParams params;
params.delegate = widget_delegate;
params.native_widget = native_constrained_window_->AsNativeWidget();
-
- if (views::Widget::IsPureViews() &&
- views::ViewsDelegate::views_delegate &&
- views::ViewsDelegate::views_delegate->GetDefaultParentView()) {
- // Don't set parent so that constrained window is attached to
- // desktop. This is necessary for key events to work under views desktop
- // because key events need to be sent to toplevel window
- // which has an inputmethod object that knows where to forward
- // event.
- } else {
- params.child = true;
- params.parent = wrapper->tab_contents()->GetNativeView();
- }
-
+ params.child = true;
+ params.parent = wrapper->tab_contents()->GetNativeView();
Init(params);
wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this);
diff --git a/chrome/browser/ui/views/dom_view.cc b/chrome/browser/ui/views/dom_view.cc
index 9027059..920c180 100644
--- a/chrome/browser/ui/views/dom_view.cc
+++ b/chrome/browser/ui/views/dom_view.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "ui/views/focus/focus_manager.h"
-#include "views/widget/native_widget_views.h"
// static
const char DOMView::kViewClassName[] =
@@ -80,17 +79,5 @@ void DOMView::ViewHierarchyChanged(bool is_add, views::View* parent,
}
void DOMView::AttachTabContents() {
-#if !defined(USE_AURA)
- if (views::Widget::IsPureViews()) {
- TabContentsViewViews* widget = static_cast<TabContentsViewViews*>(
- dom_contents_->tab_contents()->view());
- views::NativeWidgetViews* nwv =
- static_cast<views::NativeWidgetViews*>(widget->native_widget());
- AttachToView(nwv->GetView());
- } else {
-#endif
- Attach(dom_contents_->tab_contents()->GetNativeView());
-#if !defined(USE_AURA)
- }
-#endif
+ Attach(dom_contents_->tab_contents()->GetNativeView());
}
diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
index 6448250..9d81c18 100644
--- a/chrome/browser/ui/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/status_bubble.h"
#include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h"
-#include "chrome/browser/ui/views/frame/browser_frame_views.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "ui/base/hit_test.h"
@@ -90,8 +89,5 @@ gboolean BrowserFrameGtk::OnConfigureEvent(GtkWidget* widget,
NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame(
BrowserFrame* browser_frame,
BrowserView* browser_view) {
- if (views::Widget::IsPureViews() &&
- views::ViewsDelegate::views_delegate->GetDefaultParentView())
- return new BrowserFrameViews(browser_frame, browser_view);
return new BrowserFrameGtk(browser_frame, browser_view);
}
diff --git a/chrome/browser/ui/views/frame/browser_frame_views.cc b/chrome/browser/ui/views/frame/browser_frame_views.cc
deleted file mode 100644
index 8cee9ba..0000000
--- a/chrome/browser/ui/views/frame/browser_frame_views.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2011 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/views/frame/browser_frame_views.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// BrowserFrameViews, public:
-
-BrowserFrameViews::BrowserFrameViews(BrowserFrame* browser_frame,
- BrowserView* browser_view)
- : views::NativeWidgetViews(browser_frame),
- browser_view_(browser_view),
- browser_frame_(browser_frame) {
-}
-
-BrowserFrameViews::~BrowserFrameViews() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// BrowserFrameViews, NativeBrowserFrame implementation:
-
-views::NativeWidget* BrowserFrameViews::AsNativeWidget() {
- return this;
-}
-
-const views::NativeWidget* BrowserFrameViews::AsNativeWidget() const {
- return this;
-}
-
-int BrowserFrameViews::GetMinimizeButtonOffset() const {
- return 0;
-}
-
-void BrowserFrameViews::TabStripDisplayModeChanged() {
-}
-
diff --git a/chrome/browser/ui/views/frame/browser_frame_views.h b/chrome/browser/ui/views/frame/browser_frame_views.h
deleted file mode 100644
index bf9dc79..0000000
--- a/chrome/browser/ui/views/frame/browser_frame_views.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011 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_VIEWS_FRAME_BROWSER_FRAME_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_VIEWS_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "chrome/browser/ui/views/frame/browser_frame.h"
-#include "chrome/browser/ui/views/frame/native_browser_frame.h"
-#include "views/widget/native_widget_views.h"
-
-class BrowserView;
-
-////////////////////////////////////////////////////////////////////////////////
-// BrowserFrameViews
-//
-// BrowserFrameViews is a NativeWidgetViews subclass that provides the window
-// frame for the Chrome browser window.
-//
-class BrowserFrameViews : public views::NativeWidgetViews,
- public NativeBrowserFrame {
- public:
- BrowserFrameViews(BrowserFrame* browser_frame, BrowserView* browser_view);
- virtual ~BrowserFrameViews();
-
- BrowserView* browser_view() const { return browser_view_; }
-
- protected:
- // Overridden from NativeBrowserFrame:
- virtual views::NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE;
- virtual int GetMinimizeButtonOffset() const OVERRIDE;
- virtual void TabStripDisplayModeChanged() OVERRIDE;
-
- private:
- // The BrowserView is our ClientView. This is a pointer to it.
- BrowserView* browser_view_;
-
- BrowserFrame* browser_frame_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserFrameViews);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_VIEWS_H_
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc
index b766af6..68348ef 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_win.cc
@@ -10,7 +10,6 @@
#include <set>
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/views/frame/browser_frame_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "content/browser/accessibility/browser_accessibility_state.h"
#include "grit/theme_resources.h"
@@ -218,8 +217,5 @@ const gfx::Font& BrowserFrame::GetTitleFont() {
NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame(
BrowserFrame* browser_frame,
BrowserView* browser_view) {
- if (views::Widget::IsPureViews() &&
- views::ViewsDelegate::views_delegate->GetDefaultParentView())
- return new BrowserFrameViews(browser_frame, browser_view);
return new BrowserFrameWin(browser_frame, browser_view);
}
diff --git a/chrome/browser/ui/views/menu_model_adapter_test.cc b/chrome/browser/ui/views/menu_model_adapter_test.cc
index 98c20a7..82026cd 100644
--- a/chrome/browser/ui/views/menu_model_adapter_test.cc
+++ b/chrome/browser/ui/views/menu_model_adapter_test.cc
@@ -38,10 +38,6 @@ class TestViewsDelegate : public views::ViewsDelegate {
return NULL;
}
- virtual views::View* GetDefaultParentView() OVERRIDE {
- return NULL;
- }
-
virtual void SaveWindowPlacement(const views::Widget* widget,
const std::string& window_name,
const gfx::Rect& bounds,
diff --git a/chrome/browser/ui/views/native_constrained_window_views.cc b/chrome/browser/ui/views/native_constrained_window_views.cc
deleted file mode 100644
index 9895f85..0000000
--- a/chrome/browser/ui/views/native_constrained_window_views.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011 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/views/constrained_window_views.h"
-
-#include "views/widget/native_widget_views.h"
-
-class NativeConstrainedWindowViews : public NativeConstrainedWindow,
- public views::NativeWidgetViews {
- public:
- explicit NativeConstrainedWindowViews(
- NativeConstrainedWindowDelegate* delegate)
- : views::NativeWidgetViews(delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
- }
-
- virtual ~NativeConstrainedWindowViews() {
- }
-
- virtual void Activate() OVERRIDE {
- // Views version of ConstrainedWindow is not TYPE_CONTROL and not
- // visible by default. Show when it's activated.
- Show();
- views::NativeWidgetViews::Activate();
- }
-
- private:
- // Overridden from NativeConstrainedWindow:
- virtual views::NativeWidget* AsNativeWidget() OVERRIDE {
- return this;
- }
-
- NativeConstrainedWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeConstrainedWindowViews);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeConstrainedWindow, public:
-
-// static
-NativeConstrainedWindow* NativeConstrainedWindow::CreateNativeConstrainedWindow(
- NativeConstrainedWindowDelegate* delegate) {
- return new NativeConstrainedWindowViews(delegate);
-}
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
index 7c42af6..97c1265 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.h"
#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#include "content/browser/tab_contents/interstitial_page.h"
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc
index 5394892..e6e1dc7 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h"
#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
@@ -149,7 +148,5 @@ void NativeTabContentsContainerGtk::GetAccessibleState(
// static
NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer(
TabContentsContainer* container) {
- if (views::Widget::IsPureViews())
- return new NativeTabContentsContainerViews(container);
return new NativeTabContentsContainerGtk(container);
}
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.cc
deleted file mode 100644
index bba7c85..0000000
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.cc
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (c) 2011 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/views/tab_contents/native_tab_contents_container_views.h"
-
-#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
-#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
-#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
-#include "content/browser/renderer_host/render_widget_host_view.h"
-#include "content/browser/tab_contents/interstitial_page.h"
-#include "content/browser/tab_contents/tab_contents.h"
-#include "ui/base/accessibility/accessible_view_state.h"
-#include "ui/views/focus/focus_manager.h"
-#include "ui/views/focus/widget_focus_manager.h"
-#include "ui/views/layout/fill_layout.h"
-#include "views/widget/native_widget_views.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsContainerViews, public:
-
-NativeTabContentsContainerViews::NativeTabContentsContainerViews(
- TabContentsContainer* container)
- : container_(container) {
- set_id(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
- SetLayoutManager(new views::FillLayout);
-}
-
-NativeTabContentsContainerViews::~NativeTabContentsContainerViews() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsContainerViews, NativeTabContentsContainer overrides:
-
-void NativeTabContentsContainerViews::AttachContents(TabContents* contents) {
- TabContentsViewViews* widget =
- static_cast<TabContentsViewViews*>(contents->view());
- views::NativeWidgetViews* nwv =
- static_cast<views::NativeWidgetViews*>(widget->native_widget());
- AddChildView(nwv->GetView());
- Layout();
-}
-
-void NativeTabContentsContainerViews::DetachContents(TabContents* contents) {
- TabContentsViewViews* widget =
- static_cast<TabContentsViewViews*>(contents->view());
- views::NativeWidgetViews* nwv =
- static_cast<views::NativeWidgetViews*>(widget->native_widget());
- RemoveChildView(nwv->GetView());
-}
-
-void NativeTabContentsContainerViews::SetFastResize(bool fast_resize) {
-}
-
-bool NativeTabContentsContainerViews::GetFastResize() const {
- return false;
-}
-
-bool NativeTabContentsContainerViews::FastResizeAtLastLayout() const {
- return false;
-}
-
-void NativeTabContentsContainerViews::RenderViewHostChanged(
- RenderViewHost* old_host,
- RenderViewHost* new_host) {
- // If we are focused, we need to pass the focus to the new RenderViewHost.
- if (GetFocusManager()->GetFocusedView() == this)
- OnFocus();
-}
-
-views::View* NativeTabContentsContainerViews::GetView() {
- return this;
-}
-
-void NativeTabContentsContainerViews::TabContentsFocused(
- TabContents* tab_contents) {
- // This is called from RWHVViews::OnFocus, which means
- // the focus manager already set focus to RWHVViews, so don't
- // Update focus manager.
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsContainerWin, views::View overrides:
-
-bool NativeTabContentsContainerViews::SkipDefaultKeyEventProcessing(
- const views::KeyEvent& e) {
- // Don't look-up accelerators or tab-traversal if we are showing a non-crashed
- // TabContents.
- // We'll first give the page a chance to process the key events. If it does
- // not process them, they'll be returned to us and we'll treat them as
- // accelerators then.
- return container_->tab_contents() &&
- !container_->tab_contents()->is_crashed();
-}
-
-bool NativeTabContentsContainerViews::IsFocusable() const {
- // We need to be focusable when our contents is not a view hierarchy, as
- // clicking on the contents needs to focus us.
- return container_->tab_contents() != NULL;
-}
-
-void NativeTabContentsContainerViews::OnFocus() {
- if (container_->tab_contents())
- container_->tab_contents()->Focus();
-}
-
-void NativeTabContentsContainerViews::RequestFocus() {
- // This is a hack to circumvent the fact that a the OnFocus() method is not
- // invoked when RequestFocus() is called on an already focused view.
- // The TabContentsContainer is the view focused when the TabContents has
- // focus. When switching between from one tab that has focus to another tab
- // that should also have focus, RequestFocus() is invoked one the
- // TabContentsContainer. In order to make sure OnFocus() is invoked we need
- // to clear the focus before hands.
- {
- // Disable notifications. Clear focus will assign the focus to the main
- // browser window. Because this change of focus was not user requested,
- // don't send it to listeners.
- views::AutoNativeNotificationDisabler local_notification_disabler;
- GetFocusManager()->ClearFocus();
- }
- View::RequestFocus();
-}
-
-void NativeTabContentsContainerViews::AboutToRequestFocusFromTabTraversal(
- bool reverse) {
- container_->tab_contents()->FocusThroughTabTraversal(reverse);
-}
-
-void NativeTabContentsContainerViews::GetAccessibleState(
- ui::AccessibleViewState* state) {
- state->role = ui::AccessibilityTypes::ROLE_GROUPING;
-}
-
-gfx::NativeViewAccessible
- NativeTabContentsContainerViews::GetNativeViewAccessible() {
- return View::GetNativeViewAccessible();
-}
-
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h
deleted file mode 100644
index df20a8c..0000000
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011 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_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_VIEWS_H_
-#pragma once
-
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h"
-#include "views/view.h"
-
-class NativeTabContentsContainerViews : public NativeTabContentsContainer,
- public views::View {
- public:
- explicit NativeTabContentsContainerViews(TabContentsContainer* container);
- virtual ~NativeTabContentsContainerViews();
-
- // Overridden from NativeTabContentsContainer:
- virtual void AttachContents(TabContents* contents) OVERRIDE;
- virtual void DetachContents(TabContents* contents) OVERRIDE;
- virtual void SetFastResize(bool fast_resize) OVERRIDE;
- virtual bool GetFastResize() const OVERRIDE;
- virtual bool FastResizeAtLastLayout() const OVERRIDE;
- virtual void RenderViewHostChanged(RenderViewHost* old_host,
- RenderViewHost* new_host) OVERRIDE;
- virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE;
- virtual views::View* GetView() OVERRIDE;
-
- // Overridden from views::View:
- virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) OVERRIDE;
- virtual bool IsFocusable() const OVERRIDE;
- virtual void OnFocus() OVERRIDE;
- virtual void RequestFocus() OVERRIDE;
- virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
- virtual gfx::NativeViewAccessible GetNativeViewAccessible();
-
- private:
- TabContentsContainer* container_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeTabContentsContainerViews);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_CONTAINER_VIEWS_H_
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc
index 5002c05d..eb4e191 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h"
#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_views.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#include "content/browser/renderer_host/render_widget_host_view_win.h"
@@ -165,7 +164,5 @@ gfx::NativeViewAccessible
// static
NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer(
TabContentsContainer* container) {
- if (views::Widget::IsPureViews())
- return new NativeTabContentsContainerViews(container);
return new NativeTabContentsContainerWin(container);
}
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
index b2eaedf..7315011 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.h"
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc
index 9be50ff..d1ade33 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/ui/gtk/constrained_window_gtk.h"
#include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h"
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h"
#include "content/browser/renderer_host/render_widget_host_view_gtk.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
@@ -288,7 +287,5 @@ void NativeTabContentsViewGtk::PositionConstrainedWindows(
// static
NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView(
internal::NativeTabContentsViewDelegate* delegate) {
- if (views::Widget::IsPureViews())
- return new NativeTabContentsViewViews(delegate);
return new NativeTabContentsViewGtk(delegate);
}
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.cc
deleted file mode 100644
index 64bd650..0000000
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2011 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/views/tab_contents/native_tab_contents_view_views.h"
-
-#include "chrome/browser/renderer_host/render_widget_host_view_views.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate.h"
-#include "content/browser/tab_contents/tab_contents.h"
-#include "content/browser/tab_contents/tab_contents_view.h"
-#include "views/background.h"
-#include "views/widget/widget.h"
-
-// TODO(beng): HiddenTabHostWindow??
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsViewViews, public:
-
-NativeTabContentsViewViews::NativeTabContentsViewViews(
- internal::NativeTabContentsViewDelegate* delegate)
- : views::NativeWidgetViews(delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
-}
-
-NativeTabContentsViewViews::~NativeTabContentsViewViews() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsViewViews, NativeWidgetViews implementation:
-void NativeTabContentsViewViews::OnBoundsChanged(
- const gfx::Rect& new_bounds, const gfx::Rect& old_bounds) {
- // TODO(oshima): Find out if we need to adjust constrained window.
- delegate_->OnNativeTabContentsViewSized(new_bounds.size());
- views::NativeWidgetViews::OnBoundsChanged(new_bounds, old_bounds);
-}
-
-bool NativeTabContentsViewViews::OnMouseEvent(const views::MouseEvent& event) {
- if (!delegate_->IsShowingSadTab()) {
- switch (event.type()) {
- case ui::ET_MOUSE_EXITED:
- delegate_->OnNativeTabContentsViewMouseMove(false);
- break;
- case ui::ET_MOUSE_MOVED:
- delegate_->OnNativeTabContentsViewMouseMove(true);
- break;
- default:
- // TODO(oshima): mouse wheel
- break;
- }
- }
- // Pass all mouse event to renderer.
- return views::NativeWidgetViews::OnMouseEvent(event);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsViewViews, NativeTabContentsView implementation:
-
-void NativeTabContentsViewViews::InitNativeTabContentsView() {
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
- params.native_widget = this;
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- GetWidget()->Init(params);
- // Set root view to be white such that the user sees white instead of black
- // when the RWHV is destroyed as a result of navigating to a new URL.
- GetWidget()->GetRootView()->set_background(
- views::Background::CreateSolidBackground(SK_ColorWHITE));
-}
-
-void NativeTabContentsViewViews::Unparent() {
-}
-
-RenderWidgetHostView* NativeTabContentsViewViews::CreateRenderWidgetHostView(
- RenderWidgetHost* render_widget_host) {
- // Remove the old RenderWidgetHostView, otherwise SetContentsView will delete
- // it.
- views::View* old_rwhv = GetWidget()->GetContentsView();
- if (old_rwhv)
- old_rwhv->parent()->RemoveChildView(old_rwhv);
-
- RenderWidgetHostViewViews* view =
- new RenderWidgetHostViewViews(render_widget_host);
- GetWidget()->SetContentsView(view);
- view->Show();
- view->InitAsChild();
- // TODO(anicolao): implement drag'n'drop hooks if needed
- return view;
-}
-
-gfx::NativeWindow NativeTabContentsViewViews::GetTopLevelNativeWindow() const {
- NOTIMPLEMENTED();
- return NULL;
-}
-
-void NativeTabContentsViewViews::SetPageTitle(const string16& title) {
- SetWindowTitle(title);
-}
-
-void NativeTabContentsViewViews::StartDragging(
- const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops,
- const SkBitmap& image,
- const gfx::Point& image_offset) {
- NOTIMPLEMENTED();
-}
-
-void NativeTabContentsViewViews::CancelDrag() {
- NOTIMPLEMENTED();
-}
-
-bool NativeTabContentsViewViews::IsDoingDrag() const {
- NOTIMPLEMENTED();
- return false;
-}
-
-void NativeTabContentsViewViews::SetDragCursor(
- WebKit::WebDragOperation operation) {
- NOTIMPLEMENTED();
-}
-
-views::NativeWidget* NativeTabContentsViewViews::AsNativeWidget() {
- return this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeTabContentsView, public:
-#if defined(TOUCH_UI) && !defined(USE_AURA)
-// TODO(oshima): The above implies pure views only
-// static
-NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView(
- internal::NativeTabContentsViewDelegate* delegate) {
- return new NativeTabContentsViewViews(delegate);
-}
-#endif
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h
deleted file mode 100644
index 7d0c7fb..0000000
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2011 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_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_VIEWS_H_
-#pragma once
-
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h"
-#include "views/widget/native_widget_views.h"
-
-class TabContents;
-
-namespace views {
-class MouseEvent;
-}
-
-class NativeTabContentsViewViews : public views::NativeWidgetViews,
- public NativeTabContentsView {
- public:
- explicit NativeTabContentsViewViews(
- internal::NativeTabContentsViewDelegate* delegate);
- virtual ~NativeTabContentsViewViews();
-
- private:
- // Overridden from NativeWidgetViews:
- virtual void OnBoundsChanged(const gfx::Rect& new_bounds,
- const gfx::Rect& old_bounds) OVERRIDE;
- virtual bool OnMouseEvent(const views::MouseEvent& event) OVERRIDE;
-
- // Overridden from NativeTabContentsView:
- virtual void InitNativeTabContentsView() OVERRIDE;
- virtual void Unparent() OVERRIDE;
- virtual RenderWidgetHostView* CreateRenderWidgetHostView(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
- virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask ops,
- const SkBitmap& image,
- const gfx::Point& image_offset) OVERRIDE;
- virtual void CancelDrag() OVERRIDE;
- virtual bool IsDoingDrag() const OVERRIDE;
- virtual void SetDragCursor(WebKit::WebDragOperation operation) OVERRIDE;
- virtual views::NativeWidget* AsNativeWidget() OVERRIDE;
-
- internal::NativeTabContentsViewDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeTabContentsViewViews);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_VIEWS_H_
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc
index 942d4c6..b26673f 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc
@@ -6,7 +6,6 @@
#include "chrome/browser/tab_contents/web_drop_target_win.h"
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate.h"
-#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h"
#include "content/browser/renderer_host/render_widget_host_view_win.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -342,7 +341,5 @@ bool NativeTabContentsViewWin::ScrollZoom(int scroll_type) {
// static
NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView(
internal::NativeTabContentsViewDelegate* delegate) {
- if (views::Widget::IsPureViews())
- return new NativeTabContentsViewViews(delegate);
return new NativeTabContentsViewWin(delegate);
}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 45279ac..7914397 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1985,10 +1985,6 @@
'browser/renderer_host/offline_resource_handler.h',
'browser/renderer_host/plugin_info_message_filter.cc',
'browser/renderer_host/plugin_info_message_filter.h',
- 'browser/renderer_host/render_widget_host_view_views.cc',
- 'browser/renderer_host/render_widget_host_view_views.h',
- 'browser/renderer_host/render_widget_host_view_views_touch.cc',
- 'browser/renderer_host/render_widget_host_view_views_win.cc',
'browser/renderer_host/safe_browsing_resource_handler.cc',
'browser/renderer_host/safe_browsing_resource_handler.h',
'browser/renderer_host/web_cache_manager.cc',
@@ -3395,8 +3391,6 @@
'browser/ui/views/frame/browser_frame_aura.h',
'browser/ui/views/frame/browser_frame_gtk.cc',
'browser/ui/views/frame/browser_frame_gtk.h',
- 'browser/ui/views/frame/browser_frame_views.cc',
- 'browser/ui/views/frame/browser_frame_views.h',
'browser/ui/views/frame/browser_frame_win.cc',
'browser/ui/views/frame/browser_frame_win.h',
'browser/ui/views/frame/browser_non_client_frame_view.cc',
@@ -3501,7 +3495,6 @@
'browser/ui/views/login_view.cc',
'browser/ui/views/login_view.h',
'browser/ui/views/native_constrained_window_aura.cc',
- 'browser/ui/views/native_constrained_window_views.cc',
'browser/ui/views/native_constrained_window_win.cc',
'browser/ui/views/notifications/balloon_view.cc',
'browser/ui/views/notifications/balloon_view.h',
@@ -3547,8 +3540,6 @@
'browser/ui/views/tab_contents/native_tab_contents_container_aura.h',
'browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc',
'browser/ui/views/tab_contents/native_tab_contents_container_gtk.h',
- 'browser/ui/views/tab_contents/native_tab_contents_container_views.cc',
- 'browser/ui/views/tab_contents/native_tab_contents_container_views.h',
'browser/ui/views/tab_contents/native_tab_contents_container_win.cc',
'browser/ui/views/tab_contents/native_tab_contents_container_win.h',
'browser/ui/views/tab_contents/native_tab_contents_view.h',
@@ -3557,8 +3548,6 @@
'browser/ui/views/tab_contents/native_tab_contents_view_aura.h',
'browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc',
'browser/ui/views/tab_contents/native_tab_contents_view_gtk.h',
- 'browser/ui/views/tab_contents/native_tab_contents_view_views.cc',
- 'browser/ui/views/tab_contents/native_tab_contents_view_views.h',
'browser/ui/views/tab_contents/native_tab_contents_view_win.cc',
'browser/ui/views/tab_contents/native_tab_contents_view_win.h',
'browser/ui/views/tab_contents/render_view_context_menu_views.cc',
@@ -4224,10 +4213,8 @@
['exclude', '^browser/ui/views/select_file_dialog_win.cc'],
['exclude', '^browser/ui/views/simple_message_box_win.cc'],
['exclude', '^browser/ui/views/ssl_client_certificate_selector.cc'],
- ['exclude', '^browser/ui/views/tab_contents/native_tab_contents_container_views*'],
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_container_win.cc'],
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_container_win.h'],
- ['exclude', '^browser/ui/views/tab_contents/native_tab_contents_view_views*'],
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_view_win.cc'],
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_view_win.h'],
['exclude', '^browser/ui/views/tab_contents/tab_contents_drag_win.cc'],
@@ -4544,12 +4531,10 @@
'../third_party/iaccessible2/iaccessible2.gyp:iaccessible2',
'../third_party/isimpledom/isimpledom.gyp:isimpledom',
'../views/views.gyp:views',
- '../views/views.gyp:views_desktop_lib',
'../rlz/rlz.gyp:rlz_lib',
],
'export_dependent_settings': [
'../views/views.gyp:views',
- '../views/views.gyp:views_desktop_lib',
],
'sources': [
'browser/first_run/upgrade_util.cc',
@@ -4571,7 +4556,6 @@
'browser/ui/panels/panel_mouse_watcher_timer.cc',
'browser/ui/views/keyboard_overlay_delegate.cc',
'browser/ui/views/keyboard_overlay_dialog_view.cc',
- 'browser/ui/views/native_constrained_window_views.cc',
'browser/ui/views/simple_message_box_views.cc',
'browser/ui/views/simple_message_box_views.h',
'browser/ui/webui/collected_cookies_ui_delegate.cc',
@@ -4621,7 +4605,6 @@
['OS=="linux" and toolkit_views==1',{
'dependencies': [
'../views/views.gyp:views',
- '../views/views.gyp:views_desktop_lib',
],
'include_dirs': [
'<(INTERMEDIATE_DIR)',
@@ -4786,8 +4769,6 @@
['include', '^browser/ui/views/frame/browser_frame.h'],
['include', '^browser/ui/views/frame/browser_frame_gtk.cc'],
['include', '^browser/ui/views/frame/browser_frame_gtk.h'],
- ['include', '^browser/ui/views/frame/browser_frame_views.cc'],
- ['include', '^browser/ui/views/frame/browser_frame_views.h'],
['include', '^browser/ui/views/frame/browser_non_client_frame_view.cc'],
['include', '^browser/ui/views/frame/browser_non_client_frame_view.h'],
['include', '^browser/ui/views/frame/browser_root_view.cc'],
@@ -4869,14 +4850,10 @@
['include', '^browser/ui/views/tab_contents/native_tab_contents_container_aura.h'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_container_gtk.h'],
- ['include', '^browser/ui/views/tab_contents/native_tab_contents_container_views.cc'],
- ['include', '^browser/ui/views/tab_contents/native_tab_contents_container_views.h'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_view_aura.cc'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_view_aura.h'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_view_gtk.h'],
- ['include', '^browser/ui/views/tab_contents/native_tab_contents_view_views.cc'],
- ['include', '^browser/ui/views/tab_contents/native_tab_contents_view_views.h'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_view.h'],
['include', '^browser/ui/views/tab_contents/native_tab_contents_view_delegate.h'],
['include', '^browser/ui/views/tab_contents/render_view_context_menu_views.cc'],
@@ -5053,7 +5030,6 @@
['include', '^browser/ui/views/constrained_html_delegate_views.cc'],
['include', '^browser/ui/views/constrained_window_views.cc'],
['include', '^browser/ui/views/constrained_window_views.h'],
- ['include', '^browser/ui/views/native_constrained_window_views.cc'],
['include', '^browser/ui/views/tab_contents/tab_contents_container_views.cc'],
['include', '^browser/ui/views/tab_contents/tab_contents_container_views.h'],
['exclude', '^browser/ui/gtk/collected_cookies_gtk.cc'],
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 0271b16..c5dc01a 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -262,12 +262,6 @@
],
},
},],
- ['toolkit_views==1', {
- 'sources': [
- 'common/native_web_keyboard_event_views.cc',
- 'common/native_web_keyboard_event_views.h',
- ],
- }],
['use_aura==1', {
'dependencies!': [
'default_plugin/default_plugin.gyp:default_plugin',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 643b9a4..717b6a2 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1244,9 +1244,6 @@ const char kDebugViewsPaint[] = "debug-views-paint";
// available with XInput 2 (i.e. X server 1.8 or above). The id's of the
// devices can be retrieved from 'xinput list'.
const char kTouchDevices[] = "touch-devices";
-
-// Runs Chrome inside the views desktop shell.
-const char kViewsDesktop[] = "views-desktop";
#endif
#ifndef NDEBUG
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 0bda1c2..407c066 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -356,7 +356,6 @@ extern const char kKioskMode[];
#if defined(TOOLKIT_VIEWS)
extern const char kDebugViewsPaint[];
extern const char kTouchDevices[];
-extern const char kViewsDesktop[];
#endif
diff --git a/chrome/common/native_web_keyboard_event_views.cc b/chrome/common/native_web_keyboard_event_views.cc
deleted file mode 100644
index ebf167f..0000000
--- a/chrome/common/native_web_keyboard_event_views.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2011 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/common/native_web_keyboard_event_views.h"
-
-#if defined(TOOLKIT_USES_GTK)
-#include <gdk/gdk.h>
-#endif
-
-#include "base/logging.h"
-#include "ui/views/events/event.h"
-
-namespace {
-
-int ViewsFlagsToWebInputEventModifiers(int flags) {
- return
- (flags & ui::EF_SHIFT_DOWN ? WebKit::WebInputEvent::ShiftKey : 0) |
- (flags & ui::EF_CONTROL_DOWN ? WebKit::WebInputEvent::ControlKey : 0) |
- (flags & ui::EF_CAPS_LOCK_DOWN ? WebKit::WebInputEvent::CapsLockOn : 0) |
- (flags & ui::EF_ALT_DOWN ? WebKit::WebInputEvent::AltKey : 0);
-}
-
-} // namespace
-
-NativeWebKeyboardEventViews::NativeWebKeyboardEventViews(
- const views::KeyEvent& event) {
- skip_in_browser = false;
- DCHECK(event.type() == ui::ET_KEY_PRESSED ||
- event.type() == ui::ET_KEY_RELEASED);
-
- if (event.type() == ui::ET_KEY_PRESSED)
- type = WebKit::WebInputEvent::RawKeyDown;
- else
- type = WebKit::WebInputEvent::KeyUp;
-
- modifiers = ViewsFlagsToWebInputEventModifiers(event.flags());
- timeStampSeconds = event.time_stamp().ToDoubleT();
- windowsKeyCode = event.key_code();
- nativeKeyCode = windowsKeyCode;
- text[0] = event.GetCharacter();
- unmodifiedText[0] = event.GetUnmodifiedCharacter();
- setKeyIdentifierFromWindowsKeyCode();
-
-#if defined(USE_AURA)
- // TODO(beng):
- NOTIMPLEMENTED();
-#elif defined(OS_WIN)
- // |os_event| is a MSG struct, so we can copy it directly.
- os_event = event.native_event();
-#elif defined(TOOLKIT_USES_GTK)
- if (event.gdk_event()) {
- os_event = gdk_event_copy(event.gdk_event());
- nativeKeyCode = os_event->key.keyval;
- } else {
- os_event = NULL;
- }
-#endif
-
-#if defined(TOOLKIT_USES_GTK)
- match_edit_command = false;
-#endif
-}
-
-NativeWebKeyboardEventViews::NativeWebKeyboardEventViews(
- uint16 character,
- int flags,
- double time_stamp_seconds,
- FromViewsEvent) {
- skip_in_browser = true;
-
- type = WebKit::WebInputEvent::Char;
- modifiers = ViewsFlagsToWebInputEventModifiers(flags);
- timeStampSeconds = time_stamp_seconds;
- windowsKeyCode = character;
- nativeKeyCode = character;
- text[0] = character;
- unmodifiedText[0] = character;
- isSystemKey = (flags & ui::EF_ALT_DOWN) != 0;
-
-#if defined(OS_WIN)
- memset(&os_event, 0, sizeof(os_event));
-#elif defined(TOOLKIT_USES_GTK)
- os_event = NULL;
-#endif
-
-#if defined(TOOLKIT_USES_GTK)
- match_edit_command = false;
-#endif
-}
-
-NativeWebKeyboardEventViews::~NativeWebKeyboardEventViews() {
-}
diff --git a/chrome/common/native_web_keyboard_event_views.h b/chrome/common/native_web_keyboard_event_views.h
deleted file mode 100644
index ed29066..0000000
--- a/chrome/common/native_web_keyboard_event_views.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2011 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_COMMON_NATIVE_WEB_KEYBOARD_EVENT_VIEWS_H_
-#define CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_VIEWS_H_
-#pragma once
-
-#include "content/public/browser/native_web_keyboard_event.h"
-
-namespace views {
-class KeyEvent;
-}
-
-// A views implementation of NativeWebKeyboardEvent.
-struct NativeWebKeyboardEventViews : public NativeWebKeyboardEvent {
- // TODO(suzhe): remove once we get rid of Gtk from Views.
- struct FromViewsEvent {};
- // These two constructors are shared between Windows and Linux Views ports.
- explicit NativeWebKeyboardEventViews(const views::KeyEvent& event);
- // TODO(suzhe): Sadly, we need to add a meanless FromViewsEvent parameter to
- // distinguish between this contructor and above Gtk one, because they use
- // different modifier flags. We can remove this extra parameter as soon as we
- // disable above Gtk constructor in Linux Views port.
- NativeWebKeyboardEventViews(uint16 character,
- int flags,
- double time_stamp_seconds,
- FromViewsEvent);
-
- ~NativeWebKeyboardEventViews();
-};
-
-#endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_VIEWS_H_
diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp
index 1b8667e..5639feb 100644
--- a/ui/aura_shell/aura_shell.gyp
+++ b/ui/aura_shell/aura_shell.gyp
@@ -185,21 +185,5 @@
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc',
],
},
- # It's convenient for aura_shell developers to be able to build all
- # compositor and aura targets from within this solution.
- {
- 'target_name': 'buildbot_targets',
- 'type': 'none',
- 'dependencies': [
- '../../views/views.gyp:views',
- '../../views/views.gyp:views_aura_desktop',
- '../../views/views.gyp:views_desktop',
- '../../views/views.gyp:views_desktop_lib',
- '../../views/views.gyp:views_unittests',
- '../aura/aura.gyp:*',
- '../gfx/compositor/compositor.gyp:*',
- 'aura_shell_exe',
- ],
- },
],
}
diff --git a/ui/views/aura_desktop/aura_desktop_main.cc b/ui/views/aura_desktop/aura_desktop_main.cc
deleted file mode 100644
index 4fb47e5..0000000
--- a/ui/views/aura_desktop/aura_desktop_main.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) 2011 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/at_exit.h"
-#include "base/command_line.h"
-#include "base/i18n/icu_util.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
-#include "base/utf_string_conversions.h"
-#include "third_party/skia/include/core/SkXfermode.h"
-#include "ui/aura/desktop.h"
-#include "ui/aura/desktop_host.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_delegate.h"
-#include "ui/base/hit_test.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/canvas_skia.h"
-#include "ui/gfx/rect.h"
-#include "views/widget/widget.h"
-#include "views/widget/widget_delegate.h"
-
-namespace {
-
-// Trivial WindowDelegate implementation that draws a colored background.
-class DemoWindowDelegate : public aura::WindowDelegate {
- public:
- explicit DemoWindowDelegate(SkColor color) : color_(color) {}
-
- // Overridden from aura::WindowDelegate:
- virtual void OnBoundsChanging(gfx::Rect* new_bounds) OVERRIDE {}
- virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) OVERRIDE {}
- virtual void OnFocus() OVERRIDE {}
- virtual void OnBlur() OVERRIDE {}
- virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE {
- return false;
- }
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
- virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
- return HTCLIENT;
- }
- virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE {
- return true;
- }
- virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE {
- return ui::TOUCH_STATUS_END;
- }
- virtual bool ShouldActivate(aura::Event* event) OVERRIDE {
- return true;
- }
- virtual void OnActivated() OVERRIDE {}
- virtual void OnLostActive() OVERRIDE {}
- virtual void OnCaptureLost() OVERRIDE {}
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->GetSkCanvas()->drawColor(color_, SkXfermode::kSrc_Mode);
- }
- virtual void OnWindowDestroying() OVERRIDE {
- }
- virtual void OnWindowDestroyed() OVERRIDE {
- }
- virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE {
- }
-
- private:
- SkColor color_;
-
- DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate);
-};
-
-class TestView : public views::View {
- public:
- TestView() : color_shifting_(false), color_(SK_ColorYELLOW) {}
- virtual ~TestView() {}
-
- private:
- // Overridden from views::View:
- virtual void OnPaint(gfx::Canvas* canvas) {
- canvas->FillRect(color_, GetLocalBounds());
- }
- virtual bool OnMousePressed(const views::MouseEvent& event) {
- color_shifting_ = true;
- return true;
- }
- virtual void OnMouseMoved(const views::MouseEvent& event) {
- if (color_shifting_) {
- color_ = SkColorSetRGB((SkColorGetR(color_) + 5) % 255,
- SkColorGetG(color_),
- SkColorGetB(color_));
- SchedulePaint();
- }
- }
- virtual void OnMouseReleased(const views::MouseEvent& event) {
- color_shifting_ = false;
- }
-
- bool color_shifting_;
- SkColor color_;
-
- DISALLOW_COPY_AND_ASSIGN(TestView);
-};
-
-class TestWindowContents : public views::WidgetDelegateView {
- public:
- TestWindowContents() {}
- virtual ~TestWindowContents() {}
-
- private:
- // Overridden from views::View:
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->FillRect(SK_ColorGRAY, GetLocalBounds());
- }
-
- // Overridden from views::WidgetDelegateView:
- virtual string16 GetWindowTitle() const OVERRIDE {
- return ASCIIToUTF16("Test Window!");
- }
- virtual View* GetContentsView() OVERRIDE {
- return this;
- }
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowContents);
-};
-
-} // namespace
-
-int main(int argc, char** argv) {
- CommandLine::Init(argc, argv);
-
- // The exit manager is in charge of calling the dtors of singleton objects.
- base::AtExitManager exit_manager;
-
- ui::RegisterPathProvider();
- icu_util::Initialize();
- ResourceBundle::InitSharedInstance("en-US");
-
- // Create the message-loop here before creating the desktop.
- MessageLoop message_loop(MessageLoop::TYPE_UI);
-
- aura::Desktop::GetInstance();
-
- // Create a hierarchy of test windows.
- DemoWindowDelegate window_delegate1(SK_ColorBLUE);
- aura::Window* window1 = new aura::Window(&window_delegate1);
- window1->set_id(1);
- window1->Init(ui::Layer::LAYER_HAS_TEXTURE);
- window1->SetBounds(gfx::Rect(100, 100, 400, 400));
- window1->Show();
- window1->SetParent(NULL);
-
- DemoWindowDelegate window_delegate2(SK_ColorRED);
- aura::Window* window2 = new aura::Window(&window_delegate2);
- window2->set_id(2);
- window2->Init(ui::Layer::LAYER_HAS_TEXTURE);
- window2->SetBounds(gfx::Rect(200, 200, 350, 350));
- window2->Show();
- window2->SetParent(NULL);
-
- DemoWindowDelegate window_delegate3(SK_ColorGREEN);
- aura::Window* window3 = new aura::Window(&window_delegate3);
- window3->set_id(3);
- window3->Init(ui::Layer::LAYER_HAS_TEXTURE);
- window3->SetBounds(gfx::Rect(10, 10, 50, 50));
- window3->Show();
- window3->SetParent(window2);
-
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
- params.bounds = gfx::Rect(75, 75, 80, 80);
- params.parent = window2;
- widget->Init(params);
- widget->SetContentsView(new TestView);
-
- TestWindowContents* contents = new TestWindowContents;
- views::Widget* views_window = views::Widget::CreateWindowWithParentAndBounds(
- contents, window2, gfx::Rect(120, 150, 200, 200));
- views_window->Show();
-
- aura::Desktop::GetInstance()->Run();
-
- delete aura::Desktop::GetInstance();
-
- return 0;
-}
diff --git a/ui/views/desktop/desktop_background.cc b/ui/views/desktop/desktop_background.cc
deleted file mode 100644
index 7f2ab85..0000000
--- a/ui/views/desktop/desktop_background.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2011 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/desktop/desktop_background.h"
-
-#include "ui/gfx/canvas_skia.h"
-#include "ui/gfx/path.h"
-#include "views/view.h"
-
-namespace views {
-namespace desktop {
-
-DesktopBackground::DesktopBackground() {
-}
-
-DesktopBackground::~DesktopBackground() {
-}
-
-void DesktopBackground::Paint(gfx::Canvas* canvas, View* view) const {
- // Paint the sky.
- canvas->FillRect(SK_ColorCYAN, view->GetLocalBounds());
-
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setStyle(SkPaint::kFill_Style);
-
- // Paint the rolling fields of green.
- {
- gfx::Path path;
- path.moveTo(0, view->height() / 2);
- path.cubicTo(view->height() / 4, view->height() / 4,
- view->height() / 2, view->height() / 2,
- SkIntToScalar(view->width()), view->height() / 2);
- path.lineTo(SkIntToScalar(view->width()), SkIntToScalar(view->height()));
- path.lineTo(0, SkIntToScalar(view->height()));
- path.close();
-
- paint.setColor(SK_ColorGREEN);
- canvas->GetSkCanvas()->drawPath(path, paint);
- }
-
- // Paint the shining sun.
- {
- gfx::Path path;
- path.addCircle(view->height() / 4, view->height() / 8, view->height() / 16);
- path.close();
-
- paint.setColor(SK_ColorYELLOW);
- canvas->GetSkCanvas()->drawPath(path, paint);
- }
-}
-
-} // namespace desktop
-} // namespace views
diff --git a/ui/views/desktop/desktop_background.h b/ui/views/desktop/desktop_background.h
deleted file mode 100644
index a4f1de8..0000000
--- a/ui/views/desktop/desktop_background.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2011 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_DESKTOP_DESKTOP_BACKGROUND_H_
-#define UI_VIEWS_DESKTOP_DESKTOP_BACKGROUND_H_
-
-#include "base/compiler_specific.h"
-#include "views/background.h"
-
-namespace views {
-namespace desktop {
-
-class DesktopBackground : public Background {
- public:
- DesktopBackground();
- virtual ~DesktopBackground();
-
- private:
- // Overridden from Background:
- virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopBackground);
-};
-
-} // namespace desktop
-} // namespace views
-
-#endif // UI_VIEWS_DESKTOP_DESKTOP_BACKGROUND_H_
diff --git a/ui/views/desktop/desktop_main.cc b/ui/views/desktop/desktop_main.cc
deleted file mode 100644
index 9fed7a0..0000000
--- a/ui/views/desktop/desktop_main.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2011 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/at_exit.h"
-#include "base/command_line.h"
-#include "base/i18n/icu_util.h"
-#include "base/process_util.h"
-#include "base/utf_string_conversions.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
-#include "ui/views/desktop/desktop_views_delegate.h"
-#include "ui/views/desktop/desktop_window_view.h"
-#include "ui/views/focus/accelerator_handler.h"
-#include "views/widget/widget.h"
-
-#if defined(OS_WIN)
-#include <ole2.h>
-#endif
-
-#if defined(USE_WAYLAND)
-#include "ui/gfx/gl/gl_surface_egl.h"
-#include "ui/wayland/wayland_display.h"
-#include "ui/wayland/wayland_message_pump.h"
-#endif
-
-#if defined(TOOLKIT_USES_GTK)
-#include <gtk/gtk.h>
-#elif defined(OS_LINUX)
-#include <glib.h>
-#include <glib-object.h>
-#endif
-
-int main(int argc, char** argv) {
-#if defined(OS_WIN)
- OleInitialize(NULL);
-#elif defined(OS_LINUX)
- // Initializes gtk stuff.
- g_type_init();
-#if defined(TOOLKIT_USES_GTK) && !defined(USE_WAYLAND)
- gtk_init(&argc, &argv);
-#endif
-#endif
-
- CommandLine::Init(argc, argv);
-
- base::EnableTerminationOnHeapCorruption();
-
- // The exit manager is in charge of calling the dtors of singleton objects.
- base::AtExitManager exit_manager;
-
- ui::RegisterPathProvider();
- icu_util::Initialize();
-
- ResourceBundle::InitSharedInstance("en-US");
-
-#if defined(USE_WAYLAND)
- // Wayland uses EGL for drawing, so we need to initialize this as early as
- // possible.
- if (!gfx::GLSurface::InitializeOneOff()) {
- LOG(ERROR) << "Failed to initialize GLSurface";
- return -1;
- }
- ui::WaylandMessagePump wayland_message_pump(
- ui::WaylandDisplay::GetDisplay(gfx::GLSurfaceEGL::GetNativeDisplay()));
-#endif
- MessageLoop main_message_loop(MessageLoop::TYPE_UI);
-
- views::desktop::DesktopViewsDelegate views_delegate;
-
- // Desktop mode only supports a pure-views configuration.
- views::Widget::SetPureViews(true);
-
- views::desktop::DesktopWindowView::CreateDesktopWindow(
- views::desktop::DesktopWindowView::DESKTOP_DEFAULT);
- views::desktop::DesktopWindowView::desktop_window_view->CreateTestWindow(
- ASCIIToUTF16("Sample Window 1"), SK_ColorWHITE,
- gfx::Rect(500, 200, 400, 400), true);
- views::desktop::DesktopWindowView::desktop_window_view->CreateTestWindow(
- ASCIIToUTF16("Sample Window 2"), SK_ColorRED,
- gfx::Rect(600, 450, 450, 300), false);
-
- views::AcceleratorHandler accelerator_handler;
- MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler);
-
-#if defined(OS_WIN)
- OleUninitialize();
-#endif
- return 0;
-}
diff --git a/ui/views/desktop/desktop_views_delegate.cc b/ui/views/desktop/desktop_views_delegate.cc
deleted file mode 100644
index f288998..0000000
--- a/ui/views/desktop/desktop_views_delegate.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2011 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/desktop/desktop_views_delegate.h"
-
-#include "base/logging.h"
-#include "ui/views/desktop/desktop_window_view.h"
-
-namespace views {
-namespace desktop {
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopViewsDelegate, public:
-
-DesktopViewsDelegate::DesktopViewsDelegate() {
- DCHECK(!views::ViewsDelegate::views_delegate);
- views::ViewsDelegate::views_delegate = this;
-}
-
-DesktopViewsDelegate::~DesktopViewsDelegate() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopViewsDelegate, ViewsDelegate implementation:
-
-ui::Clipboard* DesktopViewsDelegate::GetClipboard() const {
- return NULL;
-}
-
-View* DesktopViewsDelegate::GetDefaultParentView() {
- return DesktopWindowView::desktop_window_view;
-}
-
-void DesktopViewsDelegate::SaveWindowPlacement(const Widget* widget,
- const std::string& window_name,
- const gfx::Rect& bounds,
- ui::WindowShowState show_state) {
-}
-
-bool DesktopViewsDelegate::GetSavedWindowPlacement(
- const std::string& window_name,
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const {
- return false;
-}
-
-void DesktopViewsDelegate::NotifyAccessibilityEvent(
- views::View* view, ui::AccessibilityTypes::Event event_type) {
-}
-
-void DesktopViewsDelegate::NotifyMenuItemFocused(const string16& menu_name,
- const string16& menu_item_name,
- int item_index,
- int item_count,
- bool has_submenu) {
-}
-
-#if defined(OS_WIN)
-HICON DesktopViewsDelegate::GetDefaultWindowIcon() const {
- return NULL;
-}
-#endif
-
-void DesktopViewsDelegate::AddRef() {
-}
-
-void DesktopViewsDelegate::ReleaseRef() {
-}
-
-int DesktopViewsDelegate::GetDispositionForEvent(int event_flags) {
- return 0;
-}
-
-} // namespace desktop
-} // namespace views
diff --git a/ui/views/desktop/desktop_views_delegate.h b/ui/views/desktop/desktop_views_delegate.h
deleted file mode 100644
index 662d9dd..0000000
--- a/ui/views/desktop/desktop_views_delegate.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2011 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_DESKTOP_DESKTOP_VIEWS_DELEGATE_H_
-#define UI_VIEWS_DESKTOP_DESKTOP_VIEWS_DELEGATE_H_
-
-#include "base/compiler_specific.h"
-#include "views/views_delegate.h"
-
-namespace views {
-namespace desktop {
-
-class DesktopViewsDelegate : public ViewsDelegate {
- public:
- DesktopViewsDelegate();
- virtual ~DesktopViewsDelegate();
-
- private:
- // Overridden from ViewsDelegate:
- virtual ui::Clipboard* GetClipboard() const OVERRIDE;
- virtual View* GetDefaultParentView() OVERRIDE;
- virtual void SaveWindowPlacement(const Widget* widget,
- const std::string& window_name,
- const gfx::Rect& bounds,
- ui::WindowShowState show_state) OVERRIDE;
- virtual bool GetSavedWindowPlacement(
- const std::string& window_name,
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const OVERRIDE;
- virtual void NotifyAccessibilityEvent(
- views::View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE;
- virtual void NotifyMenuItemFocused(const string16& menu_name,
- const string16& menu_item_name,
- int item_index,
- int item_count,
- bool has_submenu) OVERRIDE;
-#if defined(OS_WIN)
- virtual HICON GetDefaultWindowIcon() const OVERRIDE;
-#endif
- virtual void AddRef() OVERRIDE;
- virtual void ReleaseRef() OVERRIDE;
- virtual int GetDispositionForEvent(int event_flags) OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopViewsDelegate);
-};
-
-} // namespace desktop
-} // namespace views
-
-#endif // UI_VIEWS_DESKTOP_DESKTOP_VIEWS_DELEGATE_H_
diff --git a/ui/views/desktop/desktop_window_manager.cc b/ui/views/desktop/desktop_window_manager.cc
deleted file mode 100644
index 0275673..0000000
--- a/ui/views/desktop/desktop_window_manager.cc
+++ /dev/null
@@ -1,305 +0,0 @@
-// Copyright (c) 2011 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/desktop/desktop_window_manager.h"
-
-#include "ui/base/hit_test.h"
-#include "ui/gfx/point.h"
-#include "ui/gfx/rect.h"
-#include "ui/views/events/event.h"
-#include "ui/views/window/non_client_view.h"
-#include "views/widget/native_widget_private.h"
-#include "views/widget/native_widget_view.h"
-#include "views/widget/native_widget_views.h"
-#include "views/widget/widget_delegate.h"
-
-namespace {
-
-class MoveWindowController : public views::desktop::WindowController {
- public:
- MoveWindowController(views::Widget* widget, const gfx::Point& start)
- : target_(widget),
- offset_(start) {
- }
-
- virtual ~MoveWindowController() {
- }
-
- bool OnMouseEvent(const views::MouseEvent& event) {
- if (event.type()== ui::ET_MOUSE_DRAGGED) {
- gfx::Point origin = event.location().Subtract(offset_);
- gfx::Rect rect = target_->GetWindowScreenBounds();
- rect.set_origin(origin);
- target_->SetBounds(rect);
- return true;
- }
- return false;
- }
-
- private:
- views::Widget* target_;
- gfx::Point offset_;
-
- DISALLOW_COPY_AND_ASSIGN(MoveWindowController);
-};
-
-// Simple resize controller that handle all resize as if the bottom
-// right corner is selected.
-class ResizeWindowController : public views::desktop::WindowController {
- public:
- ResizeWindowController(views::Widget* widget)
- : target_(widget) {
- }
-
- virtual ~ResizeWindowController() {
- }
-
- bool OnMouseEvent(const views::MouseEvent& event) OVERRIDE {
- if (event.type()== ui::ET_MOUSE_DRAGGED) {
- gfx::Point location = event.location();
- gfx::Rect rect = target_->GetWindowScreenBounds();
- gfx::Point size = location.Subtract(rect.origin());
- target_->SetSize(gfx::Size(std::max(10, size.x()),
- std::max(10, size.y())));
- return true;
- }
- return false;
- }
-
- private:
- views::Widget* target_;
-
- DISALLOW_COPY_AND_ASSIGN(ResizeWindowController);
-};
-
-} // namespace
-
-namespace views {
-namespace desktop {
-
-WindowController::WindowController() {
-}
-
-WindowController::~WindowController() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopWindowManager, public:
-
-DesktopWindowManager::DesktopWindowManager(Widget* desktop)
- : desktop_(desktop),
- mouse_capture_(NULL),
- active_widget_(NULL) {
-}
-
-DesktopWindowManager::~DesktopWindowManager() {
- DCHECK_EQ(0U, toplevels_.size()) << "Window manager getting destroyed "
- << "before all the windows are closed.";
-}
-
-void DesktopWindowManager::UpdateWindowsAfterScreenSizeChanged(
- const gfx::Rect& new_size) {
- for (std::vector<Widget*>::iterator i = toplevels_.begin();
- i != toplevels_.end(); ++i) {
- Widget* toplevel = *i;
- if (!toplevel->IsMaximized())
- continue;
-
- // If the window is maximized, then resize it!
- toplevel->SetSize(new_size.size());
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopWindowManager, WindowManager implementation:
-
-void DesktopWindowManager::StartMoveDrag(
- views::Widget* widget,
- const gfx::Point& point) {
- DCHECK(!window_controller_.get());
- DCHECK(!HasMouseCapture());
- if (!widget->IsMaximized() && !widget->IsMinimized()) {
- gfx::Point new_point = point;
- if (desktop_->non_client_view()) {
- gfx::Rect client =
- desktop_->non_client_view()->frame_view()->GetBoundsForClientView();
- new_point.Offset(client.x(), client.y());
- }
- SetMouseCapture();
- window_controller_.reset(new MoveWindowController(widget, new_point));
- }
-}
-
-void DesktopWindowManager::StartResizeDrag(
- views::Widget* widget, const gfx::Point& point, int hittest_code) {
- DCHECK(!window_controller_.get());
- DCHECK(!HasMouseCapture());
- if (!widget->IsMaximized() &&
- !widget->IsMinimized() &&
- (widget->widget_delegate() || widget->widget_delegate()->CanResize())) {
- SetMouseCapture();
- window_controller_.reset(new ResizeWindowController(widget));
- }
-}
-
-bool DesktopWindowManager::SetMouseCapture(views::Widget* widget) {
- if (mouse_capture_)
- return false;
- if (mouse_capture_ == widget)
- return true;
- DCHECK(!HasMouseCapture());
- SetMouseCapture();
- mouse_capture_ = widget;
- return true;
-}
-
-bool DesktopWindowManager::ReleaseMouseCapture(views::Widget* widget) {
- if (!widget || mouse_capture_ != widget)
- return false;
- DCHECK(HasMouseCapture());
- ReleaseMouseCapture();
- mouse_capture_ = NULL;
- return true;
-}
-
-bool DesktopWindowManager::HasMouseCapture(const views::Widget* widget) const {
- return widget && mouse_capture_ == widget;
-}
-
-bool DesktopWindowManager::HandleKeyEvent(
- views::Widget* widget, const views::KeyEvent& event) {
- return active_widget_ ?
- static_cast<NativeWidgetViews*>(active_widget_->native_widget_private())
- ->OnKeyEvent(event) : false;
-}
-
-bool DesktopWindowManager::HandleMouseEvent(
- views::Widget* widget, const views::MouseEvent& event) {
- if (mouse_capture_) {
- views::MouseEvent translated(event, widget->GetRootView(),
- mouse_capture_->GetRootView());
- mouse_capture_->OnMouseEvent(translated);
- return true;
- }
-
- if (event.type() == ui::ET_MOUSE_PRESSED)
- ActivateWidgetAtLocation(widget, event.location());
- else if (event.type() == ui::ET_MOUSEWHEEL && active_widget_)
- return active_widget_->OnMouseEvent(event);
-
- if (window_controller_.get()) {
- if (!window_controller_->OnMouseEvent(event)) {
- ReleaseMouseCapture();
- window_controller_.reset();
- }
- return true;
- }
-
- return false;
-}
-
-ui::TouchStatus DesktopWindowManager::HandleTouchEvent(Widget* widget,
- const TouchEvent& event) {
- // If there is a widget capturing mouse events, the widget should also receive
- // touch events.
- if (mouse_capture_) {
- views::TouchEvent translated(event, widget->GetRootView(),
- mouse_capture_->GetRootView());
- return mouse_capture_->OnTouchEvent(translated);
- }
-
- // If a touch event activates a Widget, let the event still go through to the
- // activated Widget.
- if (event.type() == ui::ET_TOUCH_PRESSED)
- ActivateWidgetAtLocation(widget, event.location());
- return ui::TOUCH_STATUS_UNKNOWN;
-}
-
-void DesktopWindowManager::Register(Widget* widget) {
- DCHECK(!widget->HasObserver(this));
- if (widget->is_top_level())
- toplevels_.push_back(widget);
- widget->AddObserver(this);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopWindowManager, private:
-
-void DesktopWindowManager::OnWidgetClosing(Widget* widget) {
- if (active_widget_ && active_widget_ == widget)
- active_widget_ = NULL;
- if (widget->is_top_level()) {
- for (std::vector<Widget*>::iterator i = toplevels_.begin();
- i != toplevels_.end(); ++i) {
- if (*i == widget) {
- toplevels_.erase(i);
- break;
- }
- }
- }
-}
-
-void DesktopWindowManager::OnWidgetVisibilityChanged(Widget* widget,
- bool visible) {
- // If there's no active Widget, then activate the first visible toplevel
- // Widget.
- if (widget->is_top_level() && widget->CanActivate() && visible &&
- active_widget_ == NULL) {
- Activate(widget);
- }
-}
-
-void DesktopWindowManager::OnWidgetActivationChanged(Widget* widget,
- bool active) {
- if (active) {
- if (active_widget_)
- active_widget_->Deactivate();
- active_widget_ = widget;
- } else if (widget == active_widget_) {
- active_widget_ = NULL;
- }
-}
-
-void DesktopWindowManager::SetMouseCapture() {
- return desktop_->native_widget_private()->SetMouseCapture();
-}
-
-void DesktopWindowManager::ReleaseMouseCapture() {
- return desktop_->native_widget_private()->ReleaseMouseCapture();
-}
-
-bool DesktopWindowManager::HasMouseCapture() const {
- return desktop_->native_widget_private()->HasMouseCapture();
-}
-
-void DesktopWindowManager::Activate(Widget* widget) {
- if (widget && widget->IsActive())
- return;
-
- if (widget) {
- if (!widget->HasObserver(this))
- widget->AddObserver(this);
- widget->Activate();
- }
-}
-
-bool DesktopWindowManager::ActivateWidgetAtLocation(Widget* widget,
- const gfx::Point& point) {
- View* target = widget->GetRootView()->GetEventHandlerForPoint(point);
-
- if (target->GetClassName() == internal::NativeWidgetView::kViewClassName) {
- internal::NativeWidgetView* native_widget_view =
- static_cast<internal::NativeWidgetView*>(target);
- views::Widget* target_widget = native_widget_view->GetAssociatedWidget();
- if (!target_widget->IsActive() && target_widget->CanActivate()) {
- Activate(target_widget);
- return true;
- }
- }
-
- return false;
-}
-
-} // namespace desktop
-} // namespace views
diff --git a/ui/views/desktop/desktop_window_manager.h b/ui/views/desktop/desktop_window_manager.h
deleted file mode 100644
index 982da1b..0000000
--- a/ui/views/desktop/desktop_window_manager.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2011 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_DESKTOP_DESKTOP_WINDOW_MANAGER_H_
-#define UI_VIEWS_DESKTOP_DESKTOP_WINDOW_MANAGER_H_
-#pragma once
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "views/widget/widget.h"
-#include "views/widget/window_manager.h"
-
-
-namespace gfx {
-class Point;
-}
-
-namespace views {
-namespace desktop {
-
-class WindowController;
-
-// A tentative window manager for views destktop until we have *right*
-// implementation based on aura/layer API. This is minimum
-// implmenetation and complicated actio like moving transformed window
-// doesn't work.
-class DesktopWindowManager : public views::WindowManager,
- public Widget::Observer {
- public:
- DesktopWindowManager(Widget* desktop);
- virtual ~DesktopWindowManager();
-
- void UpdateWindowsAfterScreenSizeChanged(const gfx::Rect& new_size);
-
- // views::WindowManager implementations:
- virtual void StartMoveDrag(views::Widget* widget,
- const gfx::Point& point) OVERRIDE;
- virtual void StartResizeDrag(views::Widget* widget,
- const gfx::Point& point,
- int hittest_code);
- virtual bool SetMouseCapture(views::Widget* widget) OVERRIDE;
- virtual bool ReleaseMouseCapture(views::Widget* widget) OVERRIDE;
- virtual bool HasMouseCapture(const views::Widget* widget) const OVERRIDE;
- virtual bool HandleKeyEvent(views::Widget* widget,
- const views::KeyEvent& event) OVERRIDE;
- virtual bool HandleMouseEvent(views::Widget* widget,
- const views::MouseEvent& event) OVERRIDE;
- virtual ui::TouchStatus HandleTouchEvent(views::Widget* widget,
- const views::TouchEvent& event) OVERRIDE;
-
- virtual void Register(Widget* widget) OVERRIDE;
-
- private:
- // Overridden from Widget::Observer.
- virtual void OnWidgetClosing(Widget* widget) OVERRIDE;
- virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE;
- virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE;
-
- void SetMouseCapture();
- void ReleaseMouseCapture();
- bool HasMouseCapture() const;
-
- void Activate(Widget* widget);
-
- // Returns true if a deactivated widget at the location was activated. Returns
- // false otherwise.
- bool ActivateWidgetAtLocation(Widget* widget, const gfx::Point& point);
-
- views::Widget* desktop_;
- views::Widget* mouse_capture_;
- views::Widget* active_widget_;
-
- // An unordered list of all the top-level Widgets.
- std::vector<views::Widget*> toplevels_;
-
- scoped_ptr<WindowController> window_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopWindowManager);
-};
-
-// An behavioral interface for objects implements window resize/movement.
-class WindowController {
- public:
- WindowController();
- virtual ~WindowController();
- virtual bool OnMouseEvent(const views::MouseEvent& event) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WindowController);
-};
-
-} // namespace desktop
-} // namespace views
-
-#endif // UI_VIEWS_DESKTOP_DESKTOP_WINDOW_MANAGER_H_
diff --git a/ui/views/desktop/desktop_window_view.cc b/ui/views/desktop/desktop_window_view.cc
deleted file mode 100644
index e1ef7fa..0000000
--- a/ui/views/desktop/desktop_window_view.cc
+++ /dev/null
@@ -1,295 +0,0 @@
-// Copyright (c) 2011 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/desktop/desktop_window_view.h"
-
-#include "base/utf_string_conversions.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/compositor/layer.h"
-#include "ui/gfx/compositor/layer_animator.h"
-#include "ui/gfx/transform.h"
-#include "ui/views/desktop/desktop_background.h"
-#include "ui/views/desktop/desktop_window_manager.h"
-#include "ui/views/window/native_frame_view.h"
-#include "views/widget/native_widget_view.h"
-#include "views/widget/native_widget_views.h"
-#include "views/widget/widget.h"
-
-#if defined(USE_AURA)
-#include "views/widget/native_widget_aura.h"
-#elif defined(OS_WIN)
-#include "views/widget/native_widget_win.h"
-#elif defined(USE_WAYLAND)
-#include "views/widget/native_widget_wayland.h"
-#elif defined(TOOLKIT_USES_GTK)
-#include "views/widget/native_widget_gtk.h"
-#endif
-
-namespace views {
-namespace desktop {
-
-// The Widget that hosts the DesktopWindowView. Subclasses Widget to override
-// CreateRootView() so that the DesktopWindowRootView can be supplied instead
-// for custom event filtering.
-class DesktopWindow : public Widget {
- public:
- explicit DesktopWindow(DesktopWindowView* desktop_window_view)
- : desktop_window_view_(desktop_window_view) {}
- virtual ~DesktopWindow() {}
-
- private:
- // Overridden from Widget:
- virtual bool OnKeyEvent(const KeyEvent& event) OVERRIDE {
- return WindowManager::Get()->HandleKeyEvent(this, event);
- }
-
- virtual bool OnMouseEvent(const MouseEvent& event) OVERRIDE {
- return WindowManager::Get()->HandleMouseEvent(this, event) ||
- Widget::OnMouseEvent(event);
- }
-
- virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE {
- ui::TouchStatus status = WindowManager::Get()->
- HandleTouchEvent(this, event);
- if (status == ui::TOUCH_STATUS_UNKNOWN)
- status = Widget::OnTouchEvent(event);
- return status;
- }
-
- DesktopWindowView* desktop_window_view_;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopWindow);
-};
-
-class TestWindowContentView : public WidgetDelegateView {
- public:
- TestWindowContentView(const string16& title, SkColor color)
- : title_(title),
- color_(color) {
- }
- virtual ~TestWindowContentView() {}
-
- private:
- // Overridden from View:
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->FillRect(color_, GetLocalBounds());
- }
-
- // Overridden from WindowDelegate:
- virtual string16 GetWindowTitle() const OVERRIDE {
- return title_;
- }
- virtual View* GetContentsView() {
- return this;
- }
- virtual bool CanMaximize() const OVERRIDE {
- return true;
- }
- virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE {
- Widget* widget = View::GetWidget();
- if (widget->IsMinimized())
- widget->Restore();
- else
- widget->Minimize();
- return true;
- }
-
- string16 title_;
- SkColor color_;
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowContentView);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopWindowView, public:
-
-// static
-DesktopWindowView* DesktopWindowView::desktop_window_view = NULL;
-
-DesktopWindowView::DesktopWindowView(DesktopType type)
- : type_(type) {
- switch (type_) {
- case DESKTOP_DEFAULT:
- case DESKTOP_NETBOOK:
- set_background(new DesktopBackground);
- break;
- case DESKTOP_OTHER:
- set_background(Background::CreateStandardPanelBackground());
- break;
- }
-}
-
-DesktopWindowView::~DesktopWindowView() {
-}
-
-// static
-void DesktopWindowView::CreateDesktopWindow(DesktopType type) {
- DCHECK(!desktop_window_view);
- desktop_window_view = new DesktopWindowView(type);
- views::Widget* window = new DesktopWindow(desktop_window_view);
- desktop_window_view->widget_ = window;
-
- WindowManager::Install(new DesktopWindowManager(window));
-
- views::Widget::InitParams params;
- params.delegate = desktop_window_view;
- // In this environment, CreateChromeWindow will default to creating a views-
- // window, so we need to construct a NativeWidgetWin by hand.
- // TODO(beng): Replace this with NativeWindow::CreateNativeRootWindow().
-#if defined(USE_AURA)
- params.native_widget = new views::NativeWidgetAura(window);
-#elif defined(OS_WIN)
- params.native_widget = new views::NativeWidgetWin(window);
-#elif defined(USE_WAYLAND)
- params.native_widget = new views::NativeWidgetWayland(window);
-#elif defined(TOOLKIT_USES_GTK)
- params.native_widget = new views::NativeWidgetGtk(window);
- params.show_state = ui::SHOW_STATE_MAXIMIZED;
-#endif
- params.bounds = gfx::Rect(20, 20, 1920, 1200);
- window->Init(params);
- window->Show();
-}
-
-void DesktopWindowView::CreateTestWindow(const string16& title,
- SkColor color,
- gfx::Rect initial_bounds,
- bool rotate) {
- views::Widget* window = views::Widget::CreateWindowWithBounds(
- new TestWindowContentView(title, color),
- initial_bounds);
- window->Show();
-
- NativeWidgetViews* native_widget_views =
- static_cast<NativeWidgetViews*>(window->native_widget());
-
- if (rotate) {
- ui::Transform transform;
- transform.SetRotate(90.0f);
- transform.SetTranslateX(window->GetWindowScreenBounds().width());
- native_widget_views->GetView()->SetTransform(transform);
- }
-
- native_widget_views->GetView()->SetPaintToLayer(true);
- if (native_widget_views->GetView()->layer()) {
- native_widget_views->GetView()->layer()->SetAnimator(
- ui::LayerAnimator::CreateImplicitAnimator());
- }
-}
-
-void DesktopWindowView::AddObserver(DesktopWindowView::Observer* observer) {
- observers_.AddObserver(observer);
-}
-
-void DesktopWindowView::RemoveObserver(DesktopWindowView::Observer* observer) {
- observers_.RemoveObserver(observer);
-}
-
-bool DesktopWindowView::HasObserver(DesktopWindowView::Observer* observer) {
- return observers_.HasObserver(observer);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopWindowView, View overrides:
-
-void DesktopWindowView::Layout() {
-}
-
-void DesktopWindowView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
- static_cast<DesktopWindowManager*>(WindowManager::Get())->
- UpdateWindowsAfterScreenSizeChanged(bounds());
-
- FOR_EACH_OBSERVER(Observer, observers_,
- OnDesktopBoundsChanged(previous_bounds));
-}
-
-void DesktopWindowView::ViewHierarchyChanged(
- bool is_add, View* parent, View* child) {
- if (child->GetClassName() == internal::NativeWidgetView::kViewClassName) {
- Widget* widget =
- static_cast<internal::NativeWidgetView*>(child)->GetAssociatedWidget();
- if (is_add)
- WindowManager::Get()->Register(widget);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DesktopWindowView, WidgetDelegate implementation:
-
-Widget* DesktopWindowView::GetWidget() {
- return widget_;
-}
-
-const Widget* DesktopWindowView::GetWidget() const {
- return widget_;
-}
-
-bool DesktopWindowView::CanResize() const {
- return true;
-}
-
-bool DesktopWindowView::CanMaximize() const {
- return CanResize();
-}
-
-string16 DesktopWindowView::GetWindowTitle() const {
- return ASCIIToUTF16("Aura Desktop");
-}
-
-SkBitmap DesktopWindowView::GetWindowAppIcon() {
- return SkBitmap();
-}
-
-SkBitmap DesktopWindowView::GetWindowIcon() {
- return SkBitmap();
-}
-
-bool DesktopWindowView::ShouldShowWindowIcon() const {
- return false;
-}
-
-void DesktopWindowView::WindowClosing() {
- MessageLoopForUI::current()->Quit();
-}
-
-View* DesktopWindowView::GetContentsView() {
- return this;
-}
-
-NonClientFrameView* DesktopWindowView::CreateNonClientFrameView() {
- switch (type_) {
- case DESKTOP_DEFAULT:
- case DESKTOP_NETBOOK:
- return NULL;
-
- case DESKTOP_OTHER:
- return new NativeFrameView(widget_);
- }
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// ui::LayerAnimationObserver Implementation:
-
-void DesktopWindowView::OnLayerAnimationEnded(
- const ui::LayerAnimationSequence* animation) {
- // The layer, and all the observers should be notified of the
- // transformed size of the desktop.
- if (widget_) {
- gfx::Rect current_bounds(widget_->GetClientAreaScreenBounds().size());
- layer()->transform().TransformRect(&current_bounds);
- SetBoundsRect(gfx::Rect(current_bounds.size()));
- }
-}
-
-void DesktopWindowView::OnLayerAnimationScheduled(
- const ui::LayerAnimationSequence* animation) {
-}
-
-void DesktopWindowView::OnLayerAnimationAborted(
- const ui::LayerAnimationSequence* animation) {
-}
-
-} // namespace desktop
-} // namespace views
diff --git a/ui/views/desktop/desktop_window_view.h b/ui/views/desktop/desktop_window_view.h
deleted file mode 100644
index 475f92c..0000000
--- a/ui/views/desktop/desktop_window_view.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2011 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_DESKTOP_DESKTOP_WINDOW_VIEW_H_
-#define UI_VIEWS_DESKTOP_DESKTOP_WINDOW_VIEW_H_
-
-#include "base/observer_list.h"
-#include "ui/gfx/compositor/layer_animation_observer.h"
-#include "views/view.h"
-#include "views/widget/widget_delegate.h"
-
-namespace ui {
-class LayerAnimationSequence;
-} // namespace ui
-
-namespace views {
-
-class Widget;
-
-namespace desktop {
-
-class DesktopWindowView : public WidgetDelegateView,
- public ui::LayerAnimationObserver {
- public:
- // Observers can listen to various events on the desktop.
- class Observer {
- public:
- virtual void OnDesktopBoundsChanged(const gfx::Rect& previous_bounds) = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
- // The look and feel will be slightly different for different kinds of
- // desktop.
- enum DesktopType {
- DESKTOP_DEFAULT,
- DESKTOP_NETBOOK,
- DESKTOP_OTHER
- };
-
- static DesktopWindowView* desktop_window_view;
-
- explicit DesktopWindowView(DesktopType type);
- virtual ~DesktopWindowView();
-
- static void CreateDesktopWindow(DesktopType type);
-
- void CreateTestWindow(const string16& title,
- SkColor color,
- gfx::Rect initial_bounds,
- bool rotate);
-
- DesktopType type() const { return type_; }
-
- // Add/remove observer.
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
- bool HasObserver(Observer* observer);
-
- private:
- // Overridden from View:
- virtual void Layout() OVERRIDE;
- virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
- virtual void ViewHierarchyChanged(
- bool is_add, View* parent, View* child) OVERRIDE;
-
- // Overridden from WidgetDelegate:
- virtual Widget* GetWidget() OVERRIDE;
- virtual const Widget* GetWidget() const OVERRIDE;
- virtual bool CanResize() const OVERRIDE;
- virtual bool CanMaximize() const OVERRIDE;
- virtual string16 GetWindowTitle() const OVERRIDE;
- virtual SkBitmap GetWindowAppIcon() OVERRIDE;
- virtual SkBitmap GetWindowIcon() OVERRIDE;
- virtual bool ShouldShowWindowIcon() const OVERRIDE;
- virtual void WindowClosing() OVERRIDE;
- virtual View* GetContentsView() OVERRIDE;
- virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
-
- // Implementation of ui::LayerAnimationObserver:
- virtual void OnLayerAnimationEnded(
- const ui::LayerAnimationSequence* animation) OVERRIDE;
- virtual void OnLayerAnimationScheduled(
- const ui::LayerAnimationSequence* animation) OVERRIDE;
- virtual void OnLayerAnimationAborted(
- const ui::LayerAnimationSequence* animation) OVERRIDE;
-
- ObserverList<Observer> observers_;
- DesktopType type_;
- Widget* widget_;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopWindowView);
-};
-
-} // namespace desktop
-} // namespace views
-
-#endif // UI_VIEWS_DESKTOP_DESKTOP_WINDOW_VIEW_H_
diff --git a/ui/views/events/event_wayland.cc b/ui/views/events/event_wayland.cc
deleted file mode 100644
index be248d1..0000000
--- a/ui/views/events/event_wayland.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2011 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/events/event.h"
-
-#include "base/logging.h"
-#include "ui/base/keycodes/keyboard_code_conversion.h"
-
-namespace views {
-
-//////////////////////////////////////////////////////////////////////////////
-// KeyEvent, public:
-
-uint16 KeyEvent::GetCharacter() const {
- return ui::GetCharacterFromKeyCode(key_code_, flags());
-}
-
-uint16 KeyEvent::GetUnmodifiedCharacter() const {
- return ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN);
-}
-
-} // namespace views
diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc
index 1205196..819e6f0 100644
--- a/ui/views/examples/examples_main.cc
+++ b/ui/views/examples/examples_main.cc
@@ -21,7 +21,6 @@
#include "ui/views/examples/message_box_example.h"
#include "ui/views/examples/native_theme_button_example.h"
#include "ui/views/examples/native_theme_checkbox_example.h"
-#include "ui/views/examples/native_widget_views_example.h"
#include "ui/views/examples/progress_bar_example.h"
#include "ui/views/examples/radio_button_example.h"
#include "ui/views/examples/scroll_view_example.h"
@@ -93,7 +92,6 @@ void ExamplesMain::Init() {
examples_.push_back(new MessageBoxExample(this));
examples_.push_back(new NativeThemeButtonExample(this));
examples_.push_back(new NativeThemeCheckboxExample(this));
- examples_.push_back(new NativeWidgetViewsExample(this));
examples_.push_back(new ProgressBarExample(this));
examples_.push_back(new RadioButtonExample(this));
examples_.push_back(new ScrollViewExample(this));
diff --git a/ui/views/focus/accelerator_handler_touch.cc b/ui/views/focus/accelerator_handler_touch.cc
deleted file mode 100644
index 5012dc2..0000000
--- a/ui/views/focus/accelerator_handler_touch.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) 2011 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/focus/accelerator_handler.h"
-
-#include <X11/extensions/XInput2.h>
-#include <gtk/gtk.h>
-
-#include <bitset>
-
-#include "ui/base/touch/touch_factory.h"
-#include "ui/views/events/event.h"
-#include "ui/views/focus/focus_manager.h"
-#include "ui/views/ime/input_method.h"
-#include "views/view.h"
-#include "views/widget/native_widget.h"
-
-namespace views {
-
-namespace {
-
-Widget* FindWidgetForGdkWindow(GdkWindow* gdk_window) {
- gpointer data = NULL;
- gdk_window_get_user_data(gdk_window, &data);
- GtkWidget* gtk_widget = reinterpret_cast<GtkWidget*>(data);
- if (!gtk_widget || !GTK_IS_WIDGET(gtk_widget)) {
- DLOG(WARNING) << "no GtkWidget found for that GdkWindow";
- return NULL;
- }
- Widget* widget = Widget::GetWidgetForNativeView(gtk_widget);
-
- if (!widget) {
- DLOG(WARNING) << "no NativeWidgetGtk found for that GtkWidget";
- return NULL;
- }
- return widget;
-}
-
-} // namespace
-
-bool DispatchX2Event(Widget* widget, XEvent* xev) {
- XGenericEventCookie* cookie = &xev->xcookie;
- switch (cookie->evtype) {
- case XI_KeyPress:
- case XI_KeyRelease: {
- // TODO(sad): We don't capture XInput2 events from keyboard yet.
- break;
- }
-#if defined(USE_XI2_MT)
- case XI_TouchBegin:
- case XI_TouchEnd:
- case XI_TouchUpdate: {
- // Hide the cursor when a touch event comes in.
- ui::TouchFactory::GetInstance()->SetCursorVisible(false, false);
-
- // If the TouchEvent is processed by |widget|, then return.
- TouchEvent touch(xev);
- if (widget->OnTouchEvent(touch) != ui::TOUCH_STATUS_UNKNOWN)
- return true;
-
- // We do not want to generate a mouse event for an unprocessed touch
- // event here. That is already done by the gesture manager in
- // RootView::OnTouchEvent.
- return false;
- }
-#endif
- case XI_ButtonPress:
- case XI_ButtonRelease:
- case XI_Motion: {
- XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data);
-
- // Scrolling the wheel generates press/release events with button id's 4
- // and 5. In case of a wheelscroll, we do not want to show the cursor.
- if (xievent->detail == 4 || xievent->detail == 5) {
- MouseWheelEvent wheelev(xev);
- return widget->OnMouseEvent(wheelev);
- }
-
- ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
- // Is the event coming from a touch device?
- if (factory->IsTouchDevice(xievent->sourceid)) {
- // Hide the cursor when a touch event comes in.
- factory->SetCursorVisible(false, false);
-
- // With XInput 2.0, XI_ButtonPress and XI_ButtonRelease events are
- // ignored, as XI_Motion events contain enough data to detect finger
- // press and release. See more notes in TouchFactory::TouchParam.
- if ((cookie->evtype == XI_ButtonPress ||
- cookie->evtype == XI_ButtonRelease) &&
- factory->IsRealTouchDevice(xievent->sourceid))
- return false;
-
- // If the TouchEvent is processed by |widget|, then return. Otherwise
- // let it fall through so it can be used as a MouseEvent, if desired.
- TouchEvent touch(xev);
- if (widget->OnTouchEvent(touch) != ui::TOUCH_STATUS_UNKNOWN)
- return true;
-
- // We do not want to generate a mouse event for an unprocessed touch
- // event here. That is already done by the gesture manager in
- // RootView::OnTouchEvent.
- return false;
- } else {
- MouseEvent mouseev(xev);
-
- // Show the cursor. Start a timer to hide the cursor after a delay on
- // move (not drag) events, or if the only button pressed is released.
- bool start_timer = mouseev.type() == ui::ET_MOUSE_MOVED;
- start_timer |= mouseev.type() == ui::ET_MOUSE_RELEASED &&
- (mouseev.IsOnlyLeftMouseButton() ||
- mouseev.IsOnlyMiddleMouseButton() ||
- mouseev.IsOnlyRightMouseButton());
- factory->SetCursorVisible(true, start_timer);
-
- return widget->OnMouseEvent(mouseev);
- }
- }
- }
- return false;
-}
-
-bool DispatchXEvent(XEvent* xev) {
- GdkDisplay* gdisp = gdk_display_get_default();
- XID xwindow = xev->xany.window;
-
- if (xev->type == GenericEvent) {
- if (!ui::TouchFactory::GetInstance()->ShouldProcessXI2Event(xev))
- return true; // Consume the event.
-
- XGenericEventCookie* cookie = &xev->xcookie;
- if (cookie->evtype == XI_HierarchyChanged) {
- ui::TouchFactory::GetInstance()->UpdateDeviceList(cookie->display);
- return true;
- }
-
- XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(cookie->data);
- xwindow = xiev->event;
- }
-
- GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow);
- Widget* widget = FindWidgetForGdkWindow(gwind);
- if (widget) {
- switch (xev->type) {
- case KeyPress:
- case KeyRelease: {
- KeyEvent keyev(xev);
- InputMethod* ime = widget->GetInputMethod();
- // Always dispatch key events to the input method first, to make sure
- // that the input method's hotkeys work all time.
- if (ime) {
- ime->DispatchKeyEvent(keyev);
- return true;
- }
- return widget->OnKeyEvent(keyev);
- }
- case ButtonPress:
- case ButtonRelease:
- if (xev->xbutton.button == 4 || xev->xbutton.button == 5) {
- // Scrolling the wheel triggers button press/release events.
- MouseWheelEvent wheelev(xev);
- return widget->OnMouseEvent(wheelev);
- }
- // fallthrough
- case MotionNotify: {
- MouseEvent mouseev(xev);
- return widget->OnMouseEvent(mouseev);
- }
-
- case GenericEvent: {
- return DispatchX2Event(widget, xev);
- }
- }
- }
-
- return false;
-}
-
-AcceleratorHandler::AcceleratorHandler() {}
-
-base::MessagePumpDispatcher::DispatchStatus
- AcceleratorHandler::Dispatch(XEvent* xev) {
- return DispatchXEvent(xev) ?
- base::MessagePumpDispatcher::EVENT_PROCESSED :
- base::MessagePumpDispatcher::EVENT_IGNORED;
-}
-
-} // namespace views
diff --git a/ui/views/ime/input_method_wayland.cc b/ui/views/ime/input_method_wayland.cc
deleted file mode 100644
index d35b1bd..0000000
--- a/ui/views/ime/input_method_wayland.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2011 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/ime/input_method_wayland.h"
-
-#include "views/widget/widget.h"
-
-namespace views {
-
-InputMethodWayland::InputMethodWayland(
- internal::InputMethodDelegate *delegate) {
- set_delegate(delegate);
-}
-
-void InputMethodWayland::DispatchKeyEvent(const KeyEvent& key) {
- if (!GetTextInputClient()) {
- DispatchKeyEventPostIME(key);
- return;
- }
-
- if (key.type() == ui::ET_KEY_PRESSED) {
- ProcessKeyPressEvent(key);
- } else if (key.type() == ui::ET_KEY_RELEASED) {
- DispatchKeyEventPostIME(key);
- }
-}
-
-void InputMethodWayland::OnTextInputTypeChanged(View* view) {
- NOTIMPLEMENTED();
-}
-
-void InputMethodWayland::OnCaretBoundsChanged(View* view) {
- NOTIMPLEMENTED();
-}
-
-void InputMethodWayland::CancelComposition(View* view) {
- NOTIMPLEMENTED();
-}
-
-std::string InputMethodWayland::GetInputLocale() {
- return std::string("");
-}
-
-base::i18n::TextDirection InputMethodWayland::GetInputTextDirection() {
- return base::i18n::UNKNOWN_DIRECTION;
-}
-
-bool InputMethodWayland::IsActive() {
- return true;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// InputMethodWayland private
-
-void InputMethodWayland::ProcessKeyPressEvent(const KeyEvent& key) {
- const View* old_focused_view = focused_view();
- DispatchKeyEventPostIME(key);
-
- // We shouldn't dispatch the character anymore if the key event caused focus
- // change.
- if (old_focused_view != focused_view())
- return;
-
- // If a key event was not filtered by |context_| or |context_simple_|, then
- // it means the key event didn't generate any result text. For some cases,
- // the key event may still generate a valid character, eg. a control-key
- // event (ctrl-a, return, tab, etc.). We need to send the character to the
- // focused text input client by calling TextInputClient::InsertChar().
- char16 ch = key.GetCharacter();
- ui::TextInputClient* client = GetTextInputClient();
- if (ch && client)
- client->InsertChar(ch, key.flags());
-}
-
-} // namespace views
diff --git a/ui/views/ime/input_method_wayland.h b/ui/views/ime/input_method_wayland.h
deleted file mode 100644
index 7e937bf..0000000
--- a/ui/views/ime/input_method_wayland.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2011 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_IME_INPUT_METHOD_WAYLAND_H_
-#define UI_VIEWS_IME_INPUT_METHOD_WAYLAND_H_
-#pragma once
-
-#include <string>
-
-#include "ui/views/ime/input_method_base.h"
-
-namespace views {
-
-class InputMethodWayland : public InputMethodBase {
- public:
- explicit InputMethodWayland(internal::InputMethodDelegate *delegate);
-
- virtual void DispatchKeyEvent(const KeyEvent& key) OVERRIDE;
- virtual void OnTextInputTypeChanged(View* view) OVERRIDE;
- virtual void OnCaretBoundsChanged(View* view) OVERRIDE;
- virtual void CancelComposition(View* view) OVERRIDE;
- virtual std::string GetInputLocale() OVERRIDE;
- virtual base::i18n::TextDirection GetInputTextDirection() OVERRIDE;
- virtual bool IsActive() OVERRIDE;
-
- private:
-
- void ProcessKeyPressEvent(const KeyEvent& key);
-
- DISALLOW_COPY_AND_ASSIGN(InputMethodWayland);
-};
-
-} // namespace views
-
-#endif // UI_VIEWS_IME_INPUT_METHOD_WAYLAND_H_
diff --git a/ui/views/test/test_views_delegate.cc b/ui/views/test/test_views_delegate.cc
index 086e987..779e23c 100644
--- a/ui/views/test/test_views_delegate.cc
+++ b/ui/views/test/test_views_delegate.cc
@@ -9,8 +9,7 @@
namespace views {
-TestViewsDelegate::TestViewsDelegate()
- : default_parent_view_(NULL) {
+TestViewsDelegate::TestViewsDelegate() {
DCHECK(!ViewsDelegate::views_delegate);
ViewsDelegate::views_delegate = this;
}
@@ -27,10 +26,6 @@ ui::Clipboard* TestViewsDelegate::GetClipboard() const {
return clipboard_.get();
}
-View* TestViewsDelegate::GetDefaultParentView() {
- return default_parent_view_;
-}
-
void TestViewsDelegate::SaveWindowPlacement(const Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
diff --git a/ui/views/test/test_views_delegate.h b/ui/views/test/test_views_delegate.h
index eece1f1..7812701 100644
--- a/ui/views/test/test_views_delegate.h
+++ b/ui/views/test/test_views_delegate.h
@@ -25,13 +25,8 @@ class TestViewsDelegate : public ViewsDelegate {
TestViewsDelegate();
virtual ~TestViewsDelegate();
- void set_default_parent_view(View* view) {
- default_parent_view_ = view;
- }
-
// Overridden from ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const OVERRIDE;
- virtual View* GetDefaultParentView() OVERRIDE;
virtual void SaveWindowPlacement(const Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
@@ -61,7 +56,6 @@ class TestViewsDelegate : public ViewsDelegate {
virtual int GetDispositionForEvent(int event_flags) OVERRIDE;
private:
- View* default_parent_view_;
mutable scoped_ptr<ui::Clipboard> clipboard_;
DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate);
diff --git a/ui/views/touchui/gesture_manager.cc b/ui/views/touchui/gesture_manager.cc
index 0508592..51b2c79 100644
--- a/ui/views/touchui/gesture_manager.cc
+++ b/ui/views/touchui/gesture_manager.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "ui/views/events/event.h"
#include "views/view.h"
-#include "views/views_delegate.h"
#include "views/widget/widget.h"
namespace views {
@@ -38,28 +37,17 @@ bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event,
// location information from the native-event, so it needs to convert the
// coordinate to the target widget.
MouseEvent mouseev(event);
- if (ViewsDelegate::views_delegate->GetDefaultParentView()) {
- // TODO(oshima): We may need to send the event back through
- // window manager to handle mouse capture correctly.
- Widget* desktop =
- ViewsDelegate::views_delegate->GetDefaultParentView()->GetWidget();
- Widget* source_widget = source->GetWidget();
- MouseEvent converted(
- mouseev, desktop->GetRootView(), source_widget->GetRootView());
- source_widget->OnMouseEvent(converted);
+ Widget* source_widget = source->GetWidget();
+ Widget* top_widget = source_widget->GetTopLevelWidget();
+ if (source_widget != top_widget && top_widget) {
+ // This is necessary as TYPE_CHILD widget is still NativeWidgetGtk.
+ // Fix this once TYPE_CHILD is switched to NativeWidgetViews.
+ MouseEvent converted(mouseev,
+ top_widget->GetRootView(),
+ source_widget->GetRootView());
+ source_widget->OnMouseEvent(mouseev);
} else {
- Widget* source_widget = source->GetWidget();
- Widget* top_widget = source_widget->GetTopLevelWidget();
- if (source_widget != top_widget && top_widget) {
- // This is necessary as TYPE_CHILD widget is still NativeWidgetGtk.
- // Fix this once TYPE_CHILD is switched to NativeWidgetViews.
- MouseEvent converted(mouseev,
- top_widget->GetRootView(),
- source_widget->GetRootView());
- source_widget->OnMouseEvent(mouseev);
- } else {
- source_widget->OnMouseEvent(mouseev);
- }
+ source_widget->OnMouseEvent(mouseev);
}
return true;
}
diff --git a/views/controls/combobox/native_combobox_wayland.cc b/views/controls/combobox/native_combobox_wayland.cc
deleted file mode 100644
index c54b068..0000000
--- a/views/controls/combobox/native_combobox_wayland.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2011 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 "views/controls/combobox/native_combobox_views.h"
-
-namespace views {
-
-// static
-NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper(
- Combobox* combobox) {
- return new NativeComboboxViews(combobox);
-}
-
-} // namespace views
diff --git a/views/controls/native/native_view_host.cc b/views/controls/native/native_view_host.cc
index 0981b9d..e8c5710 100644
--- a/views/controls/native/native_view_host.cc
+++ b/views/controls/native/native_view_host.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "ui/gfx/canvas.h"
-#include "views/controls/native/native_view_host_views.h"
#include "views/controls/native/native_view_host_wrapper.h"
#include "views/widget/widget.h"
@@ -29,7 +28,6 @@ const bool NativeViewHost::kRenderNativeControlFocus = true;
NativeViewHost::NativeViewHost()
: native_view_(NULL),
- views_view_(NULL),
fast_resize_(false),
fast_resize_at_last_layout_(false),
focus_view_(NULL) {
@@ -41,7 +39,6 @@ NativeViewHost::~NativeViewHost() {
void NativeViewHost::Attach(gfx::NativeView native_view) {
DCHECK(native_view);
DCHECK(!native_view_);
- DCHECK(!views_view_);
native_view_ = native_view;
// If set_focus_view() has not been invoked, this view is the one that should
// be seen as focused when the native view receives focus.
@@ -50,21 +47,6 @@ void NativeViewHost::Attach(gfx::NativeView native_view) {
native_wrapper_->NativeViewAttached();
}
-void NativeViewHost::AttachToView(View* view) {
- if (view == views_view_)
- return;
- DCHECK(view);
- DCHECK(!native_view_);
- DCHECK(!views_view_);
- native_wrapper_.reset(new NativeViewHostViews(this));
- views_view_ = view;
- // If set_focus_view() has not been invoked, this view is the one that should
- // be seen as focused when the native view receives focus.
- if (!focus_view_)
- focus_view_ = this;
- native_wrapper_->NativeViewAttached();
-}
-
void NativeViewHost::Detach() {
Detach(false);
}
@@ -88,7 +70,7 @@ gfx::Size NativeViewHost::GetPreferredSize() {
}
void NativeViewHost::Layout() {
- if ((!native_view_ && !views_view_) || !native_wrapper_.get())
+ if (!native_view_ || !native_wrapper_.get())
return;
gfx::Rect vis_bounds = GetVisibleBounds();
@@ -197,10 +179,9 @@ gfx::NativeViewAccessible NativeViewHost::GetNativeViewAccessible() {
// NativeViewHost, private:
void NativeViewHost::Detach(bool destroyed) {
- if (native_view_ || views_view_) {
+ if (native_view_) {
native_wrapper_->NativeViewDetaching(destroyed);
native_view_ = NULL;
- views_view_ = NULL;
}
}
diff --git a/views/controls/native/native_view_host.h b/views/controls/native/native_view_host.h
index 94315be..a7a9c93 100644
--- a/views/controls/native/native_view_host.h
+++ b/views/controls/native/native_view_host.h
@@ -38,9 +38,6 @@ class VIEWS_EXPORT NativeViewHost : public View {
// added to a View hierarchy hosted within a valid Widget.
void Attach(gfx::NativeView native_view);
- // Attach a views::View instead of a native view to this host.
- void AttachToView(View* view);
-
// Detach the attached native view. Its bounds and visibility will no
// longer be manipulated by this View. The native view may be destroyed and
// detached before calling this function, and this has no effect in that case.
@@ -76,9 +73,6 @@ class VIEWS_EXPORT NativeViewHost : public View {
// Accessor for |native_view_|.
gfx::NativeView native_view() const { return native_view_; }
- // Accessor for |views_view_|.
- View* views_view() const { return views_view_; }
-
void NativeViewDestroyed();
// Overridden from View:
@@ -104,11 +98,6 @@ class VIEWS_EXPORT NativeViewHost : public View {
// attached.
gfx::NativeView native_view_;
- // The attached view. There is exactly one native_view_ or views_view_
- // attached.
- // TODO(oshima): Delete views_view_ once TOUCH_UI migrates to aura.
- View* views_view_;
-
// A platform-specific wrapper that does the OS-level manipulation of the
// attached gfx::NativeView.
scoped_ptr<NativeViewHostWrapper> native_wrapper_;
diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc
index cdb8290..85ad105 100644
--- a/views/controls/native/native_view_host_gtk.cc
+++ b/views/controls/native/native_view_host_gtk.cc
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "views/controls/native/native_view_host.h"
-#include "views/controls/native/native_view_host_views.h"
#include "ui/views/focus/focus_manager.h"
#include "views/views_delegate.h"
#include "views/widget/gtk_views_fixed.h"
@@ -405,9 +404,6 @@ gboolean NativeViewHostGtk::CallFocusIn(GtkWidget* gtk_widget,
// static
NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper(
NativeViewHost* host) {
- if (Widget::IsPureViews() &&
- views::ViewsDelegate::views_delegate->GetDefaultParentView())
- return new NativeViewHostViews(host);
return new NativeViewHostGtk(host);
}
diff --git a/views/controls/native/native_view_host_views.cc b/views/controls/native/native_view_host_views.cc
deleted file mode 100644
index 56e6e37..0000000
--- a/views/controls/native/native_view_host_views.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011 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 "views/controls/native/native_view_host_views.h"
-
-#include "base/logging.h"
-#include "ui/gfx/canvas.h"
-#include "ui/views/focus/focus_manager.h"
-#include "views/controls/native/native_view_host.h"
-#include "views/widget/root_view.h"
-#include "views/widget/widget.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeViewHostViews, public:
-
-NativeViewHostViews::NativeViewHostViews(NativeViewHost* host)
- : host_(host),
- installed_clip_(false) {
-}
-
-NativeViewHostViews::~NativeViewHostViews() {
- NOTIMPLEMENTED();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeViewHostViews, NativeViewHostWrapper implementation:
-void NativeViewHostViews::NativeViewAttached() {
- host_->AddChildView(host_->views_view());
- host_->Layout();
-}
-
-void NativeViewHostViews::NativeViewDetaching(bool destroyed) {
- host_->RemoveChildView(host_->views_view());
-}
-
-void NativeViewHostViews::AddedToWidget() {
- // nothing to do
-}
-
-void NativeViewHostViews::RemovedFromWidget() {
- // nothing to do
-}
-
-void NativeViewHostViews::InstallClip(int x, int y, int w, int h) {
- NOTIMPLEMENTED();
-}
-
-bool NativeViewHostViews::HasInstalledClip() {
- return installed_clip_;
-}
-
-void NativeViewHostViews::UninstallClip() {
- installed_clip_ = false;
-}
-
-void NativeViewHostViews::ShowWidget(int x, int y, int w, int h) {
- // x, y are in the coordinate system of the root view, but we're
- // already properly positioned by virtue of being an actual views
- // child of the NativeHostView, so disregard the origin.
- // It is important to update the visibility first, so that when the bounds is
- // set, the contents get notified of the resize (because resizing a hidden
- // views may not actually resize the contents).
- host_->views_view()->SetVisible(true);
- host_->views_view()->SetBounds(0, 0, w, h);
-}
-
-void NativeViewHostViews::HideWidget() {
- host_->views_view()->SetVisible(false);
-}
-
-void NativeViewHostViews::SetFocus() {
- host_->views_view()->RequestFocus();
-}
-
-gfx::NativeViewAccessible NativeViewHostViews::GetNativeViewAccessible() {
- return NULL;
-}
-
-} // namespace views
diff --git a/views/controls/native/native_view_host_views.h b/views/controls/native/native_view_host_views.h
deleted file mode 100644
index cd9f96b..0000000
--- a/views/controls/native/native_view_host_views.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_VIEWS_H_
-#define VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_VIEWS_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "views/controls/native/native_view_host_wrapper.h"
-
-namespace views {
-
-class NativeViewHost;
-
-// A Views implementation of NativeViewHostWrapper
-class NativeViewHostViews : public NativeViewHostWrapper {
- public:
- explicit NativeViewHostViews(NativeViewHost* host);
- virtual ~NativeViewHostViews();
-
- // Overridden from NativeViewHostWrapper:
- virtual void NativeViewAttached();
- virtual void NativeViewDetaching(bool destroyed);
- virtual void AddedToWidget();
- virtual void RemovedFromWidget();
- virtual void InstallClip(int x, int y, int w, int h);
- virtual bool HasInstalledClip();
- virtual void UninstallClip();
- virtual void ShowWidget(int x, int y, int w, int h);
- virtual void HideWidget();
- virtual void SetFocus();
- virtual gfx::NativeViewAccessible GetNativeViewAccessible();
-
- private:
- // Our associated NativeViewHost.
- NativeViewHost* host_;
-
- // Have we installed a clip region?
- bool installed_clip_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeViewHostViews);
-};
-
-} // namespace views
-
-#endif // VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_VIEWS_H_
diff --git a/views/controls/native/native_view_host_wayland.cc b/views/controls/native/native_view_host_wayland.cc
deleted file mode 100644
index 11e6a2b..0000000
--- a/views/controls/native/native_view_host_wayland.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2011 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 "views/controls/native/native_view_host.h"
-#include "views/controls/native/native_view_host_views.h"
-
-namespace views {
-
-// static
-NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper(
- NativeViewHost* host) {
- return new NativeViewHostViews(host);
-}
-
-} // namespace views
diff --git a/views/metrics_wayland.cc b/views/metrics_wayland.cc
deleted file mode 100644
index 7d3beb1..0000000
--- a/views/metrics_wayland.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2011 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 "views/metrics.h"
-
-namespace views {
-
-int GetDoubleClickInterval() {
- return 500;
-}
-
-int GetMenuShowDelay() {
- return kDefaultMenuShowDelay;
-}
-
-} // namespace views
diff --git a/views/view.cc b/views/view.cc
index 301138c..152e416 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -29,7 +29,6 @@
#include "views/drag_controller.h"
#include "views/views_delegate.h"
#include "views/widget/native_widget_private.h"
-#include "views/widget/native_widget_views.h"
#include "views/widget/root_view.h"
#include "views/widget/tooltip_manager.h"
#include "views/widget/widget.h"
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index cdcf545..eac26ed 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -2949,54 +2949,6 @@ TEST_F(ViewLayerTest, OrphanLayerAfterViewRemove) {
EXPECT_TRUE(v2->layer()->IsDrawn());
}
-// TODO(sky): reenable once focus issues are straightened out so that this
-// doesn't crash.
-TEST_F(ViewLayerTest, DISABLED_NativeWidgetView) {
- View* content_view = new View;
- widget()->SetContentsView(content_view);
- View* view = new View;
- content_view->AddChildView(view);
- view->SetBounds(10, 20, 300, 400);
-
- views_delegate().set_default_parent_view(view);
- Widget::SetPureViews(true);
- scoped_ptr<Widget> child_widget(new Widget);
- Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- params.bounds = gfx::Rect(1, 2, 100, 200);
- child_widget->Init(params);
-
- // NativeWidgetView should have been added to view.
- ASSERT_EQ(1, view->child_count());
- View* widget_view_host = view->child_at(0);
- ASSERT_TRUE(widget_view_host->layer() != NULL);
- EXPECT_EQ(gfx::Rect(11, 22, 100, 200), widget_view_host->layer()->bounds());
-
- View* widget_content_view = new View;
- child_widget->SetContentsView(widget_content_view);
- View* child_view = new View;
- child_view->SetPaintToLayer(true);
- child_view->SetBounds(5, 6, 10, 11);
- widget_content_view->AddChildView(child_view);
-
- ASSERT_TRUE(child_view->layer() != NULL);
- EXPECT_EQ(gfx::Rect(5, 6, 10, 11), child_view->layer()->bounds());
-
- widget_view_host->SetPaintToLayer(false);
- EXPECT_TRUE(widget_view_host->layer() == NULL);
-
- ASSERT_TRUE(child_view->layer() != NULL);
- EXPECT_EQ(gfx::Rect(16, 28, 10, 11), child_view->layer()->bounds());
-
- widget_view_host->SetPaintToLayer(true);
- ASSERT_TRUE(widget_view_host->layer() != NULL);
- EXPECT_EQ(gfx::Rect(11, 22, 100, 200), widget_view_host->layer()->bounds());
- ASSERT_TRUE(child_view->layer() != NULL);
- EXPECT_EQ(gfx::Rect(5, 6, 10, 11), child_view->layer()->bounds());
-
- child_widget->CloseNow();
-}
-
class PaintTrackingView : public View {
public:
PaintTrackingView() : painted_(false) {
diff --git a/views/view_wayland.cc b/views/view_wayland.cc
deleted file mode 100644
index 7524858..0000000
--- a/views/view_wayland.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 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 "views/view.h"
-
-#include "base/logging.h"
-
-namespace views {
-
-gfx::NativeViewAccessible View::GetNativeViewAccessible() {
- NOTIMPLEMENTED();
- return NULL;
-}
-
-int View::GetHorizontalDragThreshold() {
- return 8;
-}
-
-int View::GetVerticalDragThreshold() {
- return GetHorizontalDragThreshold();
-}
-
-} // namespace views
diff --git a/views/views.gyp b/views/views.gyp
index 6a183c1..ce53e67 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -24,11 +24,6 @@
['exclude', '_x\\.(h|cc)$'] ],
'dependencies': [ '../ui/aura/aura.gyp:aura', ],
}],
- ['use_wayland == 1', {
- 'dependencies': [
- '../build/linux/system.gyp:wayland',
- ],
- }],
],
},
'targets': [
@@ -84,7 +79,6 @@
'controls/combobox/native_combobox_gtk.h',
'controls/combobox/native_combobox_views.cc',
'controls/combobox/native_combobox_views.h',
- 'controls/combobox/native_combobox_wayland.cc',
'controls/combobox/native_combobox_win.cc',
'controls/combobox/native_combobox_win.h',
'controls/combobox/native_combobox_wrapper.h',
@@ -167,10 +161,6 @@
'controls/native/native_view_host_gtk.h',
'controls/native/native_view_host_win.cc',
'controls/native/native_view_host_win.h',
- 'controls/native/native_view_host_views.cc',
- 'controls/native/native_view_host_views.h',
- 'controls/native/native_view_host_wayland.cc',
- 'controls/native/native_view_host_wrapper.h',
'controls/progress_bar.h',
'controls/progress_bar.cc',
'controls/resize_area.cc',
@@ -233,7 +223,6 @@
'controls/textfield/textfield_views_model.h',
'controls/textfield/native_textfield_gtk.cc',
'controls/textfield/native_textfield_gtk.h',
- 'controls/textfield/native_textfield_wayland.cc',
'controls/textfield/native_textfield_win.cc',
'controls/textfield/native_textfield_win.h',
'controls/textfield/native_textfield_wrapper.h',
@@ -255,7 +244,6 @@
'metrics.h',
'metrics_aura.cc',
'metrics_gtk.cc',
- 'metrics_wayland.cc',
'metrics_win.cc',
'mouse_watcher.cc',
'mouse_watcher.h',
@@ -276,7 +264,6 @@
'view_gtk.cc',
'view_text_utils.cc',
'view_text_utils.h',
- 'view_wayland.cc',
'view_win.cc',
'views_delegate.h',
'widget/aero_tooltip_manager.cc',
@@ -314,12 +301,6 @@
'widget/native_widget_private.h',
'widget/native_widget_gtk.cc',
'widget/native_widget_gtk.h',
- 'widget/native_widget_wayland.cc',
- 'widget/native_widget_wayland.h',
- 'widget/native_widget_view.cc',
- 'widget/native_widget_view.h',
- 'widget/native_widget_views.cc',
- 'widget/native_widget_views.h',
'widget/native_widget_win.cc',
'widget/native_widget_win.h',
'widget/widget.cc',
@@ -344,14 +325,11 @@
'../ui/views/events/event.h',
'../ui/views/events/event_aura.cc',
'../ui/views/events/event_gtk.cc',
- '../ui/views/events/event_wayland.cc',
'../ui/views/events/event_win.cc',
'../ui/views/events/event_x.cc',
'../ui/views/focus/accelerator_handler.h',
'../ui/views/focus/accelerator_handler_aura.cc',
'../ui/views/focus/accelerator_handler_gtk.cc',
- '../ui/views/focus/accelerator_handler_touch.cc',
- '../ui/views/focus/accelerator_handler_wayland.cc',
'../ui/views/focus/accelerator_handler_win.cc',
'../ui/views/focus/external_focus_tracker.cc',
'../ui/views/focus/external_focus_tracker.h',
@@ -373,8 +351,6 @@
'../ui/views/ime/input_method.h',
'../ui/views/ime/input_method_ibus.cc',
'../ui/views/ime/input_method_ibus.h',
- '../ui/views/ime/input_method_wayland.cc',
- '../ui/views/ime/input_method_wayland.h',
'../ui/views/ime/input_method_win.cc',
'../ui/views/ime/input_method_win.h',
'../ui/views/ime/mock_input_method.cc',
@@ -416,20 +392,6 @@
'../third_party/wtl/include',
],
'conditions': [
- ['use_wayland == 1', {
- 'dependencies': [
- '../ui/wayland/wayland.gyp:wayland',
- ],
- 'sources/': [
- ['exclude', '_(gtk|x)\\.cc$'],
- ['exclude', '/(gtk|x)_[^/]*\\.cc$'],
- ['exclude', '../ui/views/focus/accelerator_handler_touch.cc'],
- ['include', 'controls/menu/native_menu_views.cc'],
- ['include', 'controls/menu/native_menu_views.h'],
- ['include', 'drag_utils_gtk.cc'],
- ['include', 'widget/tooltip_manager_views.cc'],
- ],
- }],
['use_aura==1', {
'sources/': [
['exclude', '_(gtk|x)\\.cc$'],
@@ -437,7 +399,6 @@
['exclude', 'controls/menu/menu_2.*'],
],
'sources!': [
- '../ui/views/focus/accelerator_handler_touch.cc',
'controls/menu/menu_config_linux.cc',
'controls/menu/menu_item_view_linux.cc',
'controls/menu/menu_separator_linux.cc',
@@ -702,8 +663,6 @@
'../ui/views/examples/native_theme_button_example.h',
'../ui/views/examples/native_theme_checkbox_example.cc',
'../ui/views/examples/native_theme_checkbox_example.h',
- '../ui/views/examples/native_widget_views_example.cc',
- '../ui/views/examples/native_widget_views_example.h',
'../ui/views/examples/progress_bar_example.cc',
'../ui/views/examples/progress_bar_example.h',
'../ui/views/examples/radio_button_example.cc',
@@ -766,165 +725,5 @@
}],
],
},
- {
- 'target_name': 'views_desktop_lib',
- 'type': 'static_library',
- 'dependencies': [
- '../base/base.gyp:base',
- '../chrome/chrome_resources.gyp:packed_resources',
- '../skia/skia.gyp:skia',
- '../third_party/icu/icu.gyp:icui18n',
- '../third_party/icu/icu.gyp:icuuc',
- '../ui/gfx/compositor/compositor.gyp:compositor',
- '../ui/ui.gyp:gfx_resources',
- '../ui/ui.gyp:ui',
- '../ui/ui.gyp:ui_resources',
- 'views',
- ],
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- '../ui/views/desktop/desktop_background.cc',
- '../ui/views/desktop/desktop_background.h',
- '../ui/views/desktop/desktop_window_manager.cc',
- '../ui/views/desktop/desktop_window_manager.h',
- '../ui/views/desktop/desktop_window_view.cc',
- '../ui/views/desktop/desktop_window_view.h',
- ],
- 'conditions': [
- ['toolkit_uses_gtk == 1', {
- 'dependencies': [
- '../build/linux/system.gyp:gtk',
- ],
- 'conditions': [
- ['linux_use_tcmalloc==1', {
- 'dependencies': [
- '../base/allocator/allocator.gyp:allocator',
- ],
- }],
- ],
- },
- ],
- ['OS=="win"', {
- 'link_settings': {
- 'libraries': [
- '-limm32.lib',
- '-loleacc.lib',
- ]
- },
- 'include_dirs': [
- '../third_party/wtl/include',
- ],
- }],
- ],
- },
- {
- 'target_name': 'views_desktop',
- 'type': 'executable',
- 'dependencies': [
- '../base/base.gyp:base',
- '../base/base.gyp:base_i18n',
- '../chrome/chrome_resources.gyp:packed_resources',
- '../skia/skia.gyp:skia',
- '../third_party/icu/icu.gyp:icui18n',
- '../third_party/icu/icu.gyp:icuuc',
- '../ui/ui.gyp:gfx_resources',
- '../ui/ui.gyp:ui',
- '../ui/ui.gyp:ui_resources',
- '../ui/ui.gyp:ui_resources_standard',
- '../ui/gfx/compositor/compositor.gyp:compositor',
- 'views',
- 'views_desktop_lib',
- ],
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- '../ui/views/desktop/desktop_main.cc',
- '../ui/views/desktop/desktop_views_delegate.cc',
- '../ui/views/desktop/desktop_views_delegate.h',
- '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc',
- ],
- 'conditions': [
- ['toolkit_uses_gtk == 1', {
- 'dependencies': [
- '../build/linux/system.gyp:gtk',
- ],
- },
- ],
- ['use_glib == 1', {
- 'dependencies': [
- '../build/linux/system.gyp:glib',
- ],
- 'conditions': [
- ['linux_use_tcmalloc==1', {
- 'dependencies': [
- '../base/allocator/allocator.gyp:allocator',
- ],
- }],
- ],
- }],
- ['OS=="win"', {
- 'link_settings': {
- 'libraries': [
- '-limm32.lib',
- '-loleacc.lib',
- ]
- },
- 'include_dirs': [
- '../third_party/wtl/include',
- ],
- }],
- ],
- },
- ],
- 'conditions': [
- ['use_aura==1', {
- 'targets': [
- {
- 'target_name': 'views_aura_desktop',
- 'type': 'executable',
- 'dependencies': [
- '../base/base.gyp:base',
- '../base/base.gyp:base_i18n',
- '../chrome/chrome_resources.gyp:packed_resources',
- '../skia/skia.gyp:skia',
- '../third_party/icu/icu.gyp:icui18n',
- '../third_party/icu/icu.gyp:icuuc',
- '../ui/aura/aura.gyp:aura',
- '../ui/ui.gyp:gfx_resources',
- '../ui/ui.gyp:ui',
- '../ui/ui.gyp:ui_resources',
- '../ui/ui.gyp:ui_resources_standard',
- 'views',
- ],
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- '../ui/views/aura_desktop/aura_desktop_main.cc',
- '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc',
- ],
- 'conditions': [
- ['OS=="win"', {
- 'link_settings': {
- 'libraries': [
- '-limm32.lib',
- '-loleacc.lib',
- ]
- },
- 'include_dirs': [
- '../third_party/wtl/include',
- ],
- }],
- ],
- },
- ],
- }],
],
}
diff --git a/views/views_delegate.h b/views/views_delegate.h
index 1be6657..210031a 100644
--- a/views/views_delegate.h
+++ b/views/views_delegate.h
@@ -46,12 +46,6 @@ class VIEWS_EXPORT ViewsDelegate {
// Gets the clipboard.
virtual ui::Clipboard* GetClipboard() const = 0;
- // Returns the View that all synthetic widgets created without a specified
- // parent will be parented to if they do not specify a parent in their
- // InitParams, or NULL if they should have no parent.
- // TODO(beng): perhaps this should be a Widget.
- virtual View* GetDefaultParentView() = 0;
-
// Saves the position, size and "show" state for the window with the
// specified name.
virtual void SaveWindowPlacement(const Widget* widget,
diff --git a/views/widget/native_widget_aura.h b/views/widget/native_widget_aura.h
index 05f687c..8f1383a 100644
--- a/views/widget/native_widget_aura.h
+++ b/views/widget/native_widget_aura.h
@@ -150,6 +150,9 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate,
virtual void OnDragExited() OVERRIDE;
virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE;
+ protected:
+ internal::NativeWidgetDelegate* delegate() { return delegate_; }
+
private:
class DesktopObserverImpl;
diff --git a/views/widget/native_widget_delegate.h b/views/widget/native_widget_delegate.h
index b02cf52..3732e97 100644
--- a/views/widget/native_widget_delegate.h
+++ b/views/widget/native_widget_delegate.h
@@ -7,20 +7,19 @@
#pragma once
#include "views/views_export.h"
+#include "ui/base/events.h"
namespace gfx {
class Canvas;
+class Point;
class Size;
}
-#if defined(TOUCH_UI)
-namespace ui {
-enum TouchStatus;
-}
-#endif
-
namespace views {
class InputMethod;
+class KeyEvent;
+class MouseEvent;
+class TouchEvent;
namespace internal {
diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc
index 6d79ac2..c7ef5e2 100644
--- a/views/widget/native_widget_gtk.cc
+++ b/views/widget/native_widget_gtk.cc
@@ -40,7 +40,6 @@
#include "views/widget/drop_target_gtk.h"
#include "views/widget/gtk_views_fixed.h"
#include "views/widget/gtk_views_window.h"
-#include "views/widget/native_widget_views.h"
#include "views/widget/root_view.h"
#include "views/widget/widget_delegate.h"
@@ -992,8 +991,7 @@ InputMethod* NativeWidgetGtk::CreateInputMethod() {
// Create input method when pure views is enabled but not on views desktop.
// TODO(suzhe): Always enable input method when we start to use
// RenderWidgetHostViewViews in normal ChromeOS.
- if (views::Widget::IsPureViews() &&
- !ViewsDelegate::views_delegate->GetDefaultParentView()) {
+ if (views::Widget::IsPureViews()) {
#if defined(HAVE_IBUS)
InputMethod* input_method =
InputMethodIBus::IsInputMethodIBusEnabled() ?
@@ -1005,7 +1003,7 @@ InputMethod* NativeWidgetGtk::CreateInputMethod() {
input_method->Init(GetWidget());
return input_method;
}
- // GTK's textfield or InputMethod in NativeWidgetViews will handle IME.
+ // GTK's textfield will handle IME.
return NULL;
}
@@ -1356,14 +1354,7 @@ bool NativeWidgetGtk::ConvertPointFromAncestor(
}
gfx::Rect NativeWidgetGtk::GetWorkAreaBoundsInScreen() const {
- ViewsDelegate *delegate = ViewsDelegate::views_delegate;
- if (delegate && delegate->GetDefaultParentView()) {
- // For views-desktop, the work area is the entire space inside this
- // containter window.
- return gfx::Rect(gfx::Point(0, 0),
- delegate->GetDefaultParentView()->size());
- } else
- return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView());
+ return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView());
}
void NativeWidgetGtk::SetInactiveRenderingDisabled(bool value) {
@@ -2215,10 +2206,6 @@ namespace internal {
// static
NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget(
NativeWidgetDelegate* delegate) {
- if (Widget::IsPureViews() && ViewsDelegate::views_delegate &&
- ViewsDelegate::views_delegate->GetDefaultParentView()) {
- return new NativeWidgetViews(delegate);
- }
return new NativeWidgetGtk(delegate);
}
diff --git a/views/widget/native_widget_view.cc b/views/widget/native_widget_view.cc
deleted file mode 100644
index 98b8bd5..0000000
--- a/views/widget/native_widget_view.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) 2011 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 "views/widget/native_widget_view.h"
-
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/compositor/layer.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace views {
-namespace internal {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetView, public:
-
-// static
-const char NativeWidgetView::kViewClassName[] = "views/NativeWidgetView";
-
-NativeWidgetView::NativeWidgetView(NativeWidgetViews* native_widget)
- : native_widget_(native_widget),
- sent_create_(false),
- delete_native_widget_(true),
- cursor_(gfx::kNullCursor) {
-}
-
-NativeWidgetView::~NativeWidgetView() {
- // Don't let NativeWidgetViews delete this again. This must be outside
- // the |delete_native_widget_| clause so it gets invoked for
- // WIDGET_OWNS_NATIVE_WIDGET. It is safe because |native_widget_| will
- // still exist in both ways NativeWidgetView can be destroyed: by view
- // hierarchy teardown and from the NativeWidgetViews destructor.
- native_widget_->set_delete_native_view(false);
- if (delete_native_widget_)
- delete native_widget_;
-}
-
-Widget* NativeWidgetView::GetAssociatedWidget() {
- return native_widget_->delegate()->AsWidget();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetView, View overrides:
-
-void NativeWidgetView::CalculateOffsetToAncestorWithLayer(
- gfx::Point* offset,
- ui::Layer** layer_parent) {
- View::CalculateOffsetToAncestorWithLayer(offset, layer_parent);
-}
-
-void NativeWidgetView::ReorderLayers() {
- View::ReorderLayers();
-}
-
-#if !defined(NDEBUG)
-std::string NativeWidgetView::PrintViewGraph(bool first) {
- return DoPrintViewGraph(first, GetAssociatedWidget()->GetRootView());
-}
-#endif
-
-void NativeWidgetView::ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) {
- if (is_add && child == this) {
- GetAssociatedWidget()->GetRootView()->UpdateParentLayers();
- if (!sent_create_) {
- sent_create_ = true;
- delegate()->OnNativeWidgetCreated();
- }
- }
-}
-
-void NativeWidgetView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
- native_widget_->OnBoundsChanged(bounds(), previous_bounds);
-}
-
-void NativeWidgetView::OnPaint(gfx::Canvas* canvas) {
- delegate()->OnNativeWidgetPaint(canvas);
-}
-
-gfx::NativeCursor NativeWidgetView::GetCursor(const MouseEvent& event) {
- return cursor_;
-}
-
-bool NativeWidgetView::OnMousePressed(const MouseEvent& event) {
- return native_widget_->OnMouseEvent(event);
-}
-
-bool NativeWidgetView::OnMouseDragged(const MouseEvent& event) {
- return native_widget_->OnMouseEvent(event);
-}
-
-void NativeWidgetView::OnMouseReleased(const MouseEvent& event) {
- native_widget_->OnMouseEvent(event);
-}
-
-void NativeWidgetView::OnMouseCaptureLost() {
- delegate()->OnMouseCaptureLost();
-}
-
-void NativeWidgetView::OnMouseMoved(const MouseEvent& event) {
- native_widget_->OnMouseEvent(event);
-}
-
-void NativeWidgetView::OnMouseEntered(const MouseEvent& event) {
- native_widget_->OnMouseEvent(event);
-}
-
-void NativeWidgetView::OnMouseExited(const MouseEvent& event) {
- native_widget_->OnMouseEvent(event);
-}
-
-ui::TouchStatus NativeWidgetView::OnTouchEvent(const TouchEvent& event) {
- return delegate()->OnTouchEvent(event);
-}
-
-bool NativeWidgetView::OnKeyPressed(const KeyEvent& event) {
- return delegate()->OnKeyEvent(event);
-}
-
-bool NativeWidgetView::OnKeyReleased(const KeyEvent& event) {
- return delegate()->OnKeyEvent(event);
-}
-
-bool NativeWidgetView::OnMouseWheel(const MouseWheelEvent& event) {
- return native_widget_->OnMouseEvent(event);
-}
-
-void NativeWidgetView::VisibilityChanged(View* starting_from,
- bool visible) {
- delegate()->OnNativeWidgetVisibilityChanged(visible);
-}
-
-void NativeWidgetView::OnFocus() {
- // TODO(beng): check if we have to do this.
- //delegate()->OnNativeFocus(NULL);
-}
-
-void NativeWidgetView::OnBlur() {
- // TODO(beng): check if we have to do this.
- //delegate()->OnNativeBlur(NULL);
-}
-
-std::string NativeWidgetView::GetClassName() const {
- return kViewClassName;
-}
-
-void NativeWidgetView::MoveLayerToParent(ui::Layer* parent_layer,
- const gfx::Point& point) {
- View::MoveLayerToParent(parent_layer, point);
- if (!layer() || parent_layer == layer()) {
- gfx::Point new_offset(point);
- if (layer() != parent_layer)
- new_offset.Offset(x(), y());
- GetAssociatedWidget()->GetRootView()->MoveLayerToParent(
- parent_layer, new_offset);
- }
-}
-
-void NativeWidgetView::UpdateChildLayerBounds(const gfx::Point& offset) {
- View::UpdateChildLayerBounds(offset);
- if (!layer()) {
- const gfx::Rect& bounds = GetAssociatedWidget()->GetRootView()->bounds();
- gfx::Point new_offset(offset.x() + bounds.x(), offset.y() + bounds.y());
- GetAssociatedWidget()->GetRootView()->UpdateChildLayerBounds(new_offset);
- }
-}
-
-void NativeWidgetView::ReorderChildLayers(ui::Layer* parent_layer) {
- if (layer()) {
- View::ReorderChildLayers(parent_layer);
- } else {
- GetAssociatedWidget()->GetRootView()->ReorderChildLayers(parent_layer);
- }
-}
-
-} // namespace internal
-} // namespace views
diff --git a/views/widget/native_widget_view.h b/views/widget/native_widget_view.h
deleted file mode 100644
index a64cbf7..0000000
--- a/views/widget/native_widget_view.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WIDGET_VIEW_H_
-#define VIEWS_WIDGET_NATIVE_WIDGET_VIEW_H_
-#pragma once
-
-#include "views/view.h"
-#include "views/widget/native_widget_delegate.h"
-#include "views/widget/native_widget_views.h"
-
-namespace ui {
-enum TouchStatus;
-}
-
-namespace views {
-namespace internal {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetView
-//
-// This class represents the View that is the "native view" for a
-// NativeWidgetViews. It is the View that is a member of the parent Widget's
-// View hierarchy. It is responsible for receiving relevant events from that
-// hierarchy and forwarding them to its NativeWidgetViews' delegate's hierarchy.
-//
-class VIEWS_EXPORT NativeWidgetView : public View {
- public:
- static const char kViewClassName[];
-
- explicit NativeWidgetView(NativeWidgetViews* native_widget);
- virtual ~NativeWidgetView();
-
- Widget* GetAssociatedWidget();
-
- void set_delete_native_widget(bool delete_native_widget) {
- delete_native_widget_ = delete_native_widget;
- }
-
- void set_cursor(gfx::NativeCursor cursor) { cursor_ = cursor; }
-
- // Overridden from View:
- virtual void CalculateOffsetToAncestorWithLayer(
- gfx::Point* offset,
- ui::Layer** layer_parent) OVERRIDE;
- virtual void ReorderLayers() OVERRIDE;
-
-#if !defined(NDEBUG)
- virtual std::string PrintViewGraph(bool first) OVERRIDE;
-#endif
-
- private:
- // Overridden from View:
- virtual void ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) OVERRIDE;
- virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const MouseEvent& event) OVERRIDE;
- virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE;
- virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE;
- virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE;
- virtual void OnMouseCaptureLost() OVERRIDE;
- virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE;
- virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE;
- virtual void OnMouseExited(const MouseEvent& event) OVERRIDE;
- virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event) OVERRIDE;
- virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE;
- virtual bool OnKeyReleased(const KeyEvent& event) OVERRIDE;
- virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE;
- virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE;
- virtual void OnFocus() OVERRIDE;
- virtual void OnBlur() OVERRIDE;
- virtual std::string GetClassName() const OVERRIDE;
- virtual void MoveLayerToParent(ui::Layer* parent_layer,
- const gfx::Point& point) OVERRIDE;
- virtual void UpdateChildLayerBounds(const gfx::Point& offset) OVERRIDE;
- virtual void ReorderChildLayers(ui::Layer* parent_layer) OVERRIDE;
-
- internal::NativeWidgetDelegate* delegate() {
- return native_widget_->delegate();
- }
-
- NativeWidgetViews* native_widget_;
-
- // Have we sent OnNativeWidgetCreated?
- bool sent_create_;
-
- bool delete_native_widget_;
-
- // The cursor set for the associated widget.
- gfx::NativeCursor cursor_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWidgetView);
-};
-
-} // namespace internal
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WIDGET_VIEW_H_
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc
deleted file mode 100644
index 6ebe1d7..0000000
--- a/views/widget/native_widget_views.cc
+++ /dev/null
@@ -1,648 +0,0 @@
-// Copyright (c) 2011 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 "views/widget/native_widget_views.h"
-
-#include "base/bind.h"
-#include "ui/base/hit_test.h"
-#include "ui/gfx/compositor/compositor.h"
-#include "ui/gfx/compositor/layer.h"
-#include "ui/gfx/compositor/layer_animator.h"
-#include "views/view.h"
-#include "views/views_delegate.h"
-#include "views/widget/native_widget_view.h"
-#include "views/widget/root_view.h"
-#include "views/widget/tooltip_manager_views.h"
-#include "views/widget/window_manager.h"
-
-#if defined(HAVE_IBUS)
-#include "ui/views/ime/input_method_ibus.h"
-#else
-#include "ui/views/ime/mock_input_method.h"
-#endif
-
-namespace {
-
-gfx::Rect AdjustRectOriginForParentWidget(const gfx::Rect& rect,
- const views::Widget* parent) {
- if (!parent)
- return rect;
-
- gfx::Rect adjusted = rect;
- gfx::Rect parent_bounds = parent->GetWindowScreenBounds();
- adjusted.Offset(-parent_bounds.x(), -parent_bounds.y());
- return adjusted;
-}
-
-} // namespace
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetViews, public:
-
-NativeWidgetViews::NativeWidgetViews(internal::NativeWidgetDelegate* delegate)
- : delegate_(delegate),
- parent_(NULL),
- view_(NULL),
- active_(false),
- window_state_(ui::SHOW_STATE_DEFAULT),
- always_on_top_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)),
- ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
- delete_native_view_(true) {
-}
-
-NativeWidgetViews::~NativeWidgetViews() {
- delegate_->OnNativeWidgetDestroying();
-
- if (view_ && delete_native_view_) {
- // We must prevent the NativeWidgetView from attempting to delete us.
- view_->set_delete_native_widget(false);
- delete view_;
- }
-
- delegate_->OnNativeWidgetDestroyed();
- if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
- delete delegate_;
-}
-
-View* NativeWidgetViews::GetView() {
- return view_;
-}
-
-const View* NativeWidgetViews::GetView() const {
- return view_;
-}
-
-void NativeWidgetViews::OnActivate(bool active) {
- // TODO(oshima): find out if we should check toplevel here.
- if (active_ == active)
- return;
- active_ = active;
- delegate_->OnNativeWidgetActivationChanged(active);
-
- // TODO(oshima): Focus change should be separated from window activation.
- // This will be fixed when we have WM API.
- Widget* widget = GetWidget();
- if (widget->is_top_level()) {
- InputMethod* input_method = widget->GetInputMethod();
- if (active) {
- input_method->OnFocus();
- // See description of got_initial_focus_in_ for details on this.
- widget->GetFocusManager()->RestoreFocusedView();
- } else {
- input_method->OnBlur();
- widget->GetFocusManager()->StoreFocusedView();
- }
- }
- view_->SchedulePaint();
-}
-
-bool NativeWidgetViews::OnKeyEvent(const KeyEvent& key_event) {
- InputMethod* input_method = GetWidget()->GetInputMethod();
- DCHECK(input_method);
- input_method->DispatchKeyEvent(key_event);
- return true;
-}
-
-void NativeWidgetViews::DispatchKeyEventPostIME(const KeyEvent& key) {
- // TODO(oshima): GTK impl handles menu_key in special way. This may be
- // necessary when running under NativeWidgetX.
- if (delegate_->OnKeyEvent(key))
- return;
- if (key.type() == ui::ET_KEY_PRESSED && GetWidget()->GetFocusManager())
- GetWidget()->GetFocusManager()->OnKeyEvent(key);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetViews, protected:
-
-void NativeWidgetViews::OnBoundsChanged(const gfx::Rect& new_bounds,
- const gfx::Rect& old_bounds) {
- delegate_->OnNativeWidgetSizeChanged(new_bounds.size());
-}
-
-bool NativeWidgetViews::OnMouseEvent(const MouseEvent& event) {
-#if defined(TOUCH_UI) || defined(USE_AURA)
- TooltipManagerViews* tooltip_manager =
- static_cast<TooltipManagerViews*>(GetTooltipManager());
- if (tooltip_manager)
- tooltip_manager->UpdateForMouseEvent(event);
-#endif
- return HandleWindowOperation(event) ? true : delegate_->OnMouseEvent(event);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetViews, NativeWidget implementation:
-
-void NativeWidgetViews::InitNativeWidget(const Widget::InitParams& params) {
- parent_ = params.parent_widget;
- ownership_ = params.ownership;
- always_on_top_ = params.keep_on_top;
- View* parent_view = NULL;
- if (params.parent_widget) {
- parent_view = params.parent_widget->GetChildViewParent();
- } else if (ViewsDelegate::views_delegate &&
- ViewsDelegate::views_delegate->GetDefaultParentView() &&
- !params.child) {
- parent_view = ViewsDelegate::views_delegate->GetDefaultParentView();
- } else if (params.parent) {
- Widget* widget = Widget::GetWidgetForNativeView(params.parent);
- parent_view = widget->GetChildViewParent();
- }
-
- gfx::Rect bounds = GetWidget()->is_top_level() ?
- AdjustRectOriginForParentWidget(params.bounds, parent_) : params.bounds;
- view_ = new internal::NativeWidgetView(this);
- view_->SetBoundsRect(bounds);
- view_->SetVisible(params.type == Widget::InitParams::TYPE_CONTROL);
-
- // With the default NATIVE_WIDGET_OWNS_WIDGET ownership, the
- // deletion of either of the NativeWidgetViews or NativeWidgetView
- // (e.g. via View hierarchy destruction) will delete the other.
- // With WIDGET_OWNS_NATIVE_WIDGET, NativeWidgetViews should only
- // be deleted by its Widget.
- if (ownership_ == Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET)
- view_->set_delete_native_widget(false);
-
- if (parent_view)
- parent_view->AddChildView(view_);
- view_->SetPaintToLayer(true);
- if (View::get_use_acceleration_when_possible())
- view_->SetFillsBoundsOpaquely(!params.transparent);
- // TODO(beng): SetInitParams().
-}
-
-NonClientFrameView* NativeWidgetViews::CreateNonClientFrameView() {
- return NULL;
-}
-
-void NativeWidgetViews::UpdateFrameAfterFrameChange() {
-}
-
-bool NativeWidgetViews::ShouldUseNativeFrame() const {
-// NOTIMPLEMENTED();
- return false;
-}
-
-void NativeWidgetViews::FrameTypeChanged() {
-}
-
-Widget* NativeWidgetViews::GetWidget() {
- return delegate_->AsWidget();
-}
-
-const Widget* NativeWidgetViews::GetWidget() const {
- return delegate_->AsWidget();
-}
-
-gfx::NativeView NativeWidgetViews::GetNativeView() const {
- return GetParentNativeWidget() ?
- GetParentNativeWidget()->GetNativeView() : NULL;
-}
-
-gfx::NativeWindow NativeWidgetViews::GetNativeWindow() const {
- return GetParentNativeWidget() ?
- GetParentNativeWidget()->GetNativeWindow() : NULL;
-}
-
-Widget* NativeWidgetViews::GetTopLevelWidget() {
- // This can get called when this is in the process of being destroyed, and
- // view_ has already been unset.
- if (!view_)
- return GetWidget();
- if (ViewsDelegate::views_delegate &&
- view_->parent() == ViewsDelegate::views_delegate->GetDefaultParentView())
- return GetWidget();
- // During Widget destruction, this function may be called after |view_| is
- // detached from a Widget, at which point this NativeWidget's Widget becomes
- // the effective toplevel.
- Widget* containing_widget = view_->GetWidget();
- return containing_widget ? containing_widget->GetTopLevelWidget()
- : GetWidget();
-}
-
-const ui::Compositor* NativeWidgetViews::GetCompositor() const {
- return view_->GetWidget() ? view_->GetWidget()->GetCompositor() : NULL;
-}
-
-ui::Compositor* NativeWidgetViews::GetCompositor() {
- return view_->GetWidget() ? view_->GetWidget()->GetCompositor() : NULL;
-}
-
-void NativeWidgetViews::CalculateOffsetToAncestorWithLayer(
- gfx::Point* offset,
- ui::Layer** layer_parent) {
- view_->CalculateOffsetToAncestorWithLayer(offset, layer_parent);
-}
-
-void NativeWidgetViews::ReorderLayers() {
- view_->ReorderLayers();
-}
-
-void NativeWidgetViews::ViewRemoved(View* view) {
- internal::NativeWidgetPrivate* parent = GetParentNativeWidget();
- if (parent)
- parent->ViewRemoved(view);
-}
-
-void NativeWidgetViews::SetNativeWindowProperty(const char* name, void* value) {
- if (value)
- props_map_[name] = value;
- else
- props_map_.erase(name);
-}
-
-void* NativeWidgetViews::GetNativeWindowProperty(const char* name) const {
- PropsMap::const_iterator iter = props_map_.find(name);
- return iter != props_map_.end() ? iter->second : NULL;
-}
-
-TooltipManager* NativeWidgetViews::GetTooltipManager() const {
- const internal::NativeWidgetPrivate* parent = GetParentNativeWidget();
- return parent ? parent->GetTooltipManager() : NULL;
-}
-
-bool NativeWidgetViews::IsScreenReaderActive() const {
- return GetParentNativeWidget()->IsScreenReaderActive();
-}
-
-void NativeWidgetViews::SendNativeAccessibilityEvent(
- View* view,
- ui::AccessibilityTypes::Event event_type) {
- return GetParentNativeWidget()->SendNativeAccessibilityEvent(view,
- event_type);
-}
-
-void NativeWidgetViews::SetMouseCapture() {
- WindowManager::Get()->SetMouseCapture(GetWidget());
-}
-
-void NativeWidgetViews::ReleaseMouseCapture() {
- WindowManager::Get()->ReleaseMouseCapture(GetWidget());
-}
-
-bool NativeWidgetViews::HasMouseCapture() const {
- return WindowManager::Get()->HasMouseCapture(GetWidget());
-}
-
-InputMethod* NativeWidgetViews::CreateInputMethod() {
-#if defined(HAVE_IBUS)
- InputMethod* input_method = new InputMethodIBus(this);
-#else
- InputMethod* input_method = new MockInputMethod(this);
-#endif
- input_method->Init(GetWidget());
- return input_method;
-}
-
-void NativeWidgetViews::CenterWindow(const gfx::Size& size) {
- const gfx::Size parent_size = GetView()->parent()->size();
- GetView()->SetBounds((parent_size.width() - size.width())/2,
- (parent_size.height() - size.height())/2,
- size.width(), size.height());
-}
-
-void NativeWidgetViews::GetWindowPlacement(
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const {
- *bounds = GetView()->bounds();
- *show_state = ui::SHOW_STATE_NORMAL;
-}
-
-void NativeWidgetViews::SetWindowTitle(const string16& title) {
-}
-
-void NativeWidgetViews::SetWindowIcons(const SkBitmap& window_icon,
- const SkBitmap& app_icon) {
-}
-
-void NativeWidgetViews::SetAccessibleName(const string16& name) {
-}
-
-void NativeWidgetViews::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
-}
-
-void NativeWidgetViews::SetAccessibleState(
- ui::AccessibilityTypes::State state) {
-}
-
-void NativeWidgetViews::BecomeModal() {
- NOTIMPLEMENTED();
-}
-
-gfx::Rect NativeWidgetViews::GetWindowScreenBounds() const {
- if (GetWidget() == GetWidget()->GetTopLevelWidget() &&
- !parent_)
- return view_->bounds();
- gfx::Point origin = view_->bounds().origin();
- View::ConvertPointToScreen(view_->parent(), &origin);
- return gfx::Rect(origin.x(), origin.y(), view_->width(), view_->height());
-}
-
-gfx::Rect NativeWidgetViews::GetClientAreaScreenBounds() const {
- return GetWindowScreenBounds();
-}
-
-gfx::Rect NativeWidgetViews::GetRestoredBounds() const {
- return GetWindowScreenBounds();
-}
-
-void NativeWidgetViews::SetBounds(const gfx::Rect& bounds) {
- // |bounds| are supplied in the coordinates of the parent.
- if (GetWidget()->is_top_level())
- view_->SetBoundsRect(AdjustRectOriginForParentWidget(bounds, parent_));
- else
- view_->SetBoundsRect(bounds);
-}
-
-void NativeWidgetViews::SetSize(const gfx::Size& size) {
- view_->SetSize(size);
-}
-
-void NativeWidgetViews::MoveAbove(gfx::NativeView native_view) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetViews::MoveToTop() {
- view_->parent()->ReorderChildView(view_, -1);
-}
-
-void NativeWidgetViews::SetShape(gfx::NativeRegion region) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetViews::Close() {
- Hide();
- if (!close_widget_factory_.HasWeakPtrs()) {
- MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&NativeWidgetViews::CloseNow,
- close_widget_factory_.GetWeakPtr()));
- }
-}
-
-void NativeWidgetViews::CloseNow() {
- delete view_;
- view_ = NULL;
-}
-
-void NativeWidgetViews::EnableClose(bool enable) {
-}
-
-void NativeWidgetViews::Show() {
- if (always_on_top_)
- MoveToTop();
- view_->SetVisible(true);
- GetWidget()->SetInitialFocus();
-}
-
-void NativeWidgetViews::Hide() {
- view_->SetVisible(false);
- if (HasMouseCapture())
- ReleaseMouseCapture();
-
- // This is necessary because views desktop's window manager doesn't
- // set the focus back to parent.
- if (GetWidget()->is_top_level()) {
- Widget* parent_widget = view_->GetWidget();
- if (parent_widget && parent_widget->GetInputMethod())
- parent_widget->GetInputMethod()->OnFocus();
- }
-}
-
-void NativeWidgetViews::ShowWithWindowState(ui::WindowShowState show_state) {
- Show();
-}
-
-void NativeWidgetViews::ShowMaximizedWithBounds(
- const gfx::Rect& restored_bounds) {
- Show();
-}
-
-bool NativeWidgetViews::IsVisible() const {
- return view_->IsVisible() && (GetWidget()->is_top_level() ||
- GetWidget()->GetTopLevelWidget()->IsVisible());
-}
-
-void NativeWidgetViews::Activate() {
- // Enable WidgetObserverTest.ActivationChange when this is implemented.
- MoveToTop();
- OnActivate(true);
-}
-
-void NativeWidgetViews::Deactivate() {
- OnActivate(false);
-}
-
-bool NativeWidgetViews::IsActive() const {
- return active_;
-}
-
-void NativeWidgetViews::SetAlwaysOnTop(bool on_top) {
- always_on_top_ = on_top;
- // This is not complete yet. At least |MoveToTop| will need to be updated to
- // make sure a 'normal' window does not get on top of a window with
- // |always_on_top_| set.
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetViews::Maximize() {
- if (window_state_ == ui::SHOW_STATE_MAXIMIZED)
- return;
-
- if (window_state_ != ui::SHOW_STATE_MINIMIZED) {
- // Remember bounds and transform to use when unmaximized.
- restored_bounds_ = view_->bounds();
- restored_transform_ = view_->GetTransform();
- }
-
- window_state_ = ui::SHOW_STATE_MAXIMIZED;
- gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size();
- SetBounds(gfx::Rect(gfx::Point(), size));
-}
-
-void NativeWidgetViews::Minimize() {
- if (view_->layer() && view_->layer()->GetAnimator()->is_animating())
- return;
-
- gfx::Rect view_bounds = view_->bounds();
- gfx::Rect parent_bounds = view_->parent()->bounds();
-
- if (window_state_ != ui::SHOW_STATE_MAXIMIZED) {
- restored_bounds_ = view_bounds;
- restored_transform_ = view_->GetTransform();
- }
-
- float aspect_ratio = static_cast<float>(view_bounds.width()) /
- static_cast<float>(view_bounds.height());
- int target_size = 100;
- int target_height = target_size;
- int target_width = static_cast<int>(aspect_ratio * target_height);
- if (target_width > target_size) {
- target_width = target_size;
- target_height = static_cast<int>(target_width / aspect_ratio);
- }
-
- int target_x = 20;
- int target_y = parent_bounds.height() - target_size - 20;
-
- view_->SetBounds(
- target_x, target_y, view_bounds.width(), view_bounds.height());
-
- ui::Transform transform;
- transform.SetScale((float)target_width / (float)view_bounds.width(),
- (float)target_height / (float)view_bounds.height());
- view_->SetTransform(transform);
-
- window_state_ = ui::SHOW_STATE_MINIMIZED;
-}
-
-bool NativeWidgetViews::IsMaximized() const {
- return window_state_ == ui::SHOW_STATE_MAXIMIZED;
-}
-
-bool NativeWidgetViews::IsMinimized() const {
- return window_state_ == ui::SHOW_STATE_MINIMIZED;
-}
-
-void NativeWidgetViews::Restore() {
- if (view_->layer() && view_->layer()->GetAnimator()->is_animating())
- return;
-
- window_state_ = ui::SHOW_STATE_NORMAL;
- view_->SetBoundsRect(restored_bounds_);
- view_->SetTransform(restored_transform_);
-}
-
-void NativeWidgetViews::SetFullscreen(bool fullscreen) {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetViews::IsFullscreen() const {
- // NOTIMPLEMENTED();
- return false;
-}
-
-void NativeWidgetViews::SetOpacity(unsigned char opacity) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetViews::SetUseDragFrame(bool use_drag_frame) {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetViews::IsAccessibleWidget() const {
- NOTIMPLEMENTED();
- return false;
-}
-
-void NativeWidgetViews::RunShellDrag(View* view,
- const ui::OSExchangeData& data,
- int operation) {
- GetParentNativeWidget()->RunShellDrag(view, data, operation);
-}
-
-void NativeWidgetViews::SchedulePaintInRect(const gfx::Rect& rect) {
- view_->SchedulePaintInRect(rect);
-}
-
-void NativeWidgetViews::SetCursor(gfx::NativeCursor cursor) {
- view_->set_cursor(cursor);
- GetParentNativeWidget()->SetCursor(cursor);
-}
-
-void NativeWidgetViews::ClearNativeFocus() {
- GetParentNativeWidget()->ClearNativeFocus();
-}
-
-void NativeWidgetViews::FocusNativeView(gfx::NativeView native_view) {
- GetParentNativeWidget()->FocusNativeView(native_view);
-}
-
-bool NativeWidgetViews::ConvertPointFromAncestor(
- const Widget* ancestor, gfx::Point* point) const {
- // This method converts the point from ancestor's coordinates to
- // this widget's coordinate using recursion as the widget hierachy
- // is usually shallow.
-
- if (ancestor == GetWidget())
- return true; // no conversion necessary
-
- const Widget* parent_widget = view_->GetWidget();
- if (!parent_widget) // couldn't reach the ancestor.
- return false;
-
- if (parent_widget == ancestor ||
- parent_widget->ConvertPointFromAncestor(ancestor, point)) {
- View::ConvertPointToView(parent_widget->GetRootView(), GetView(), point);
- return true;
- }
- return false;
-}
-
-gfx::Rect NativeWidgetViews::GetWorkAreaBoundsInScreen() const {
- return GetParentNativeWidget()->GetWorkAreaBoundsInScreen();
-}
-
-void NativeWidgetViews::SetInactiveRenderingDisabled(bool value) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetViews, private:
-
-internal::NativeWidgetPrivate* NativeWidgetViews::GetParentNativeWidget() {
- Widget* containing_widget = view_ ? view_->GetWidget() : NULL;
- return containing_widget ? static_cast<internal::NativeWidgetPrivate*>(
- containing_widget->native_widget()) :
- NULL;
-}
-
-const internal::NativeWidgetPrivate*
- NativeWidgetViews::GetParentNativeWidget() const {
- const Widget* containing_widget = view_ ? view_->GetWidget() : NULL;
- return containing_widget ? static_cast<const internal::NativeWidgetPrivate*>(
- containing_widget->native_widget()) :
- NULL;
-}
-
-bool NativeWidgetViews::HandleWindowOperation(const MouseEvent& event) {
- if (event.type() != ui::ET_MOUSE_PRESSED)
- return false;
-
- Widget* widget = GetWidget();
- if (widget->non_client_view()) {
- int hittest_code = widget->non_client_view()->NonClientHitTest(
- event.location());
- switch (hittest_code) {
- case HTCAPTION: {
- if (!event.IsOnlyRightMouseButton()) {
- WindowManager::Get()->StartMoveDrag(widget, event.location());
- return true;
- }
- break;
- }
- case HTBOTTOM:
- case HTBOTTOMLEFT:
- case HTBOTTOMRIGHT:
- case HTGROWBOX:
- case HTLEFT:
- case HTRIGHT:
- case HTTOP:
- case HTTOPLEFT:
- case HTTOPRIGHT: {
- WindowManager::Get()->StartResizeDrag(
- widget, event.location(), hittest_code);
- return true;
- }
- default:
- // Everything else falls into standard client event handling.
- break;
- }
- }
- return false;
-}
-
-} // namespace views
diff --git a/views/widget/native_widget_views.h b/views/widget/native_widget_views.h
deleted file mode 100644
index caf48dd..0000000
--- a/views/widget/native_widget_views.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WIDGET_VIEWS_H_
-#define VIEWS_WIDGET_NATIVE_WIDGET_VIEWS_H_
-#pragma once
-
-#include <map>
-
-#include "base/memory/weak_ptr.h"
-#include "base/message_loop.h"
-#include "ui/base/ui_base_types.h"
-#include "ui/gfx/transform.h"
-#include "views/widget/native_widget_private.h"
-#include "views/widget/widget.h"
-
-namespace views {
-namespace desktop {
-class DesktopWindowView;
-}
-
-namespace internal {
-class NativeWidgetView;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetViews
-//
-// A NativeWidget implementation that uses another View as its native widget.
-//
-class VIEWS_EXPORT NativeWidgetViews : public internal::NativeWidgetPrivate {
- public:
- explicit NativeWidgetViews(internal::NativeWidgetDelegate* delegate);
- virtual ~NativeWidgetViews();
-
- // TODO(beng): remove.
- View* GetView();
- const View* GetView() const;
-
- // TODO(oshima): These will be moved to WM API.
- void OnActivate(bool active);
- bool OnKeyEvent(const KeyEvent& key_event);
-
- void set_delete_native_view(bool delete_native_view) {
- delete_native_view_ = delete_native_view;
- }
-
- internal::NativeWidgetDelegate* delegate() const { return delegate_; }
-
- protected:
- friend class internal::NativeWidgetView;
-
- // Event handlers that subclass can implmenet custom behavior.
- virtual void OnBoundsChanged(const gfx::Rect& new_bounds,
- const gfx::Rect& old_bounds);
- virtual bool OnMouseEvent(const MouseEvent& event);
-
- // Overridden from internal::NativeWidgetPrivate:
- virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE;
- virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
- virtual void UpdateFrameAfterFrameChange() OVERRIDE;
- virtual bool ShouldUseNativeFrame() const OVERRIDE;
- virtual void FrameTypeChanged() OVERRIDE;
- virtual Widget* GetWidget() OVERRIDE;
- virtual const Widget* GetWidget() const OVERRIDE;
- virtual gfx::NativeView GetNativeView() const OVERRIDE;
- virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual Widget* GetTopLevelWidget() OVERRIDE;
- virtual const ui::Compositor* GetCompositor() const OVERRIDE;
- virtual ui::Compositor* GetCompositor() OVERRIDE;
- virtual void CalculateOffsetToAncestorWithLayer(
- gfx::Point* offset,
- ui::Layer** layer_parent) OVERRIDE;
- virtual void ReorderLayers() OVERRIDE;
- virtual void ViewRemoved(View* view) OVERRIDE;
- virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
- virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
- virtual TooltipManager* GetTooltipManager() const OVERRIDE;
- virtual bool IsScreenReaderActive() const OVERRIDE;
- virtual void SendNativeAccessibilityEvent(
- View* view,
- ui::AccessibilityTypes::Event event_type) OVERRIDE;
- virtual void SetMouseCapture() OVERRIDE;
- virtual void ReleaseMouseCapture() OVERRIDE;
- virtual bool HasMouseCapture() const OVERRIDE;
- virtual InputMethod* CreateInputMethod() OVERRIDE;
- virtual void CenterWindow(const gfx::Size& size) OVERRIDE;
- virtual void GetWindowPlacement(
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const OVERRIDE;
- virtual void SetWindowTitle(const string16& title) OVERRIDE;
- virtual void SetWindowIcons(const SkBitmap& window_icon,
- const SkBitmap& app_icon) OVERRIDE;
- virtual void SetAccessibleName(const string16& name) OVERRIDE;
- virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
- virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
- virtual void BecomeModal() OVERRIDE;
- virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
- virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
- virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
- virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
- virtual void SetSize(const gfx::Size& size) OVERRIDE;
- virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE;
- virtual void MoveToTop() OVERRIDE;
- virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
- virtual void Close() OVERRIDE;
- virtual void CloseNow() OVERRIDE;
- virtual void EnableClose(bool enable) OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual void ShowMaximizedWithBounds(
- const gfx::Rect& restored_bounds) OVERRIDE;
- virtual void ShowWithWindowState(ui::WindowShowState window_state) OVERRIDE;
- virtual bool IsVisible() const OVERRIDE;
- virtual void Activate() OVERRIDE;
- virtual void Deactivate() OVERRIDE;
- virtual bool IsActive() const OVERRIDE;
- virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
- virtual void Maximize() OVERRIDE;
- virtual void Minimize() OVERRIDE;
- virtual bool IsMaximized() const OVERRIDE;
- virtual bool IsMinimized() const OVERRIDE;
- virtual void Restore() OVERRIDE;
- virtual void SetFullscreen(bool fullscreen) OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
- virtual void SetOpacity(unsigned char opacity) OVERRIDE;
- virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
- virtual bool IsAccessibleWidget() const OVERRIDE;
- virtual void RunShellDrag(View* view,
- const ui::OSExchangeData& data,
- int operation) OVERRIDE;
- virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE;
- virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
- virtual void ClearNativeFocus() OVERRIDE;
- virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE;
- virtual bool ConvertPointFromAncestor(
- const Widget* ancestor, gfx::Point* point) const OVERRIDE;
- virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE;
- virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE;
-
- // Overridden from internal::InputMethodDelegate
- virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
-
- private:
- friend class desktop::DesktopWindowView;
-
- typedef std::map<const char*, void*> PropsMap;
-
- // These functions may return NULL during Widget destruction.
- internal::NativeWidgetPrivate* GetParentNativeWidget();
- const internal::NativeWidgetPrivate* GetParentNativeWidget() const;
-
- bool HandleWindowOperation(const MouseEvent& event);
-
- internal::NativeWidgetDelegate* delegate_;
-
- // Parent Widget (can be NULL).
- Widget* parent_;
-
- internal::NativeWidgetView* view_;
-
- bool active_;
-
- ui::WindowShowState window_state_;
-
- // Set when SetAlwaysOnTop is called, or keep_on_top is set during creation.
- bool always_on_top_;
-
- // The following factory is used for calls to close the NativeWidgetViews
- // instance.
- base::WeakPtrFactory<NativeWidgetViews> close_widget_factory_;
-
- gfx::Rect restored_bounds_;
- ui::Transform restored_transform_;
-
- // See class documentation for Widget in widget.h for a note about ownership.
- Widget::InitParams::Ownership ownership_;
-
- bool delete_native_view_;
-
- // Map used by Set/GetNativeWindowProperty.
- PropsMap props_map_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWidgetViews);
-};
-
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WIDGET_VIEWS_H_
diff --git a/views/widget/native_widget_wayland.cc b/views/widget/native_widget_wayland.cc
deleted file mode 100644
index 989d08d..0000000
--- a/views/widget/native_widget_wayland.cc
+++ /dev/null
@@ -1,683 +0,0 @@
-// Copyright (c) 2011 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 "views/widget/native_widget_wayland.h"
-
-#include <EGL/egl.h>
-#include <GL/gl.h>
-#include <cairo-gl.h>
-#include <cairo.h>
-#include <wayland-egl.h>
-
-#include <algorithm>
-#include <list>
-
-#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/wayland/wayland_event.h"
-#include "ui/base/view_prop.h"
-#include "ui/gfx/canvas_skia_paint.h"
-#include "ui/gfx/compositor/compositor.h"
-#include "ui/gfx/gl/gl_surface.h"
-#include "ui/gfx/gl/gl_surface_egl.h"
-#include "ui/views/ime/input_method_wayland.h"
-#include "ui/wayland/wayland_display.h"
-#include "ui/wayland/wayland_input_device.h"
-#include "ui/wayland/wayland_screen.h"
-#include "ui/wayland/wayland_window.h"
-#include "views/views_delegate.h"
-#include "views/widget/native_widget_views.h"
-#include "views/widget/root_view.h"
-#include "views/widget/tooltip_manager_views.h"
-
-using ui::ViewProp;
-
-using base::wayland::WaylandEvent;
-
-namespace views {
-
-namespace {
-
-// Links the WaylandWidget to its NativeWidget.
-const char* const kNativeWidgetKey = "__VIEWS_NATIVE_WIDGET__";
-
-} // namespace
-
-NativeWidgetWayland::NativeWidgetWayland(
- internal::NativeWidgetDelegate* delegate)
- : delegate_(delegate),
- ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)),
- ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
- has_mouse_capture_(false),
- wayland_display_(
- ui:: WaylandDisplay::GetDisplay(gfx::GLSurfaceEGL::GetNativeDisplay())),
- wayland_window_(new ui::WaylandWindow(this, wayland_display_)),
- surface_data_key_(),
- damage_area_() {
-}
-
-NativeWidgetWayland::~NativeWidgetWayland() {
- if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
- delete delegate_;
-
- if (!View::get_use_acceleration_when_possible()) {
- cairo_surface_destroy(cairo_surface_);
- cairo_device_destroy(device_);
- }
-
- if (egl_window_)
- wl_egl_window_destroy(egl_window_);
-
- if (wayland_window_)
- delete wayland_window_;
-}
-
-void NativeWidgetWayland::InitNativeWidget(const Widget::InitParams& params) {
- // Cannot create a window with a size smaller than 1x1
- allocation_.set_width(std::max(params.bounds.width(), 1));
- allocation_.set_height(std::max(params.bounds.height(), 1));
-
- egl_window_ = wl_egl_window_create(wayland_window_->surface(),
- allocation_.width(),
- allocation_.height());
-
- SetNativeWindowProperty(kNativeWidgetKey, this);
-
- if (View::get_use_acceleration_when_possible()) {
- if (ui::Compositor::compositor_factory()) {
- compositor_ = (*ui::Compositor::compositor_factory())(this);
- } else {
- compositor_ = ui::Compositor::Create(this,
- egl_window_,
- allocation_.size());
- }
- if (compositor_.get())
- delegate_->AsWidget()->GetRootView()->SetPaintToLayer(true);
- } else {
- surface_ = gfx::GLSurface::CreateViewGLSurface(false, egl_window_);
- context_ = gfx::GLContext::CreateGLContext(
- NULL,
- surface_.get(),
- gfx::PreferIntegratedGpu);
-
- if (!context_->MakeCurrent(surface_.get()))
- DLOG(ERROR) << "Failed to make surface current";
-
- device_ = cairo_egl_device_create(gfx::GLSurfaceEGL::GetHardwareDisplay(),
- context_->GetHandle());
- if (cairo_device_status(device_) != CAIRO_STATUS_SUCCESS)
- DLOG(ERROR) << "Failed to create cairo egl device";
-
- cairo_surface_ = cairo_gl_surface_create_for_egl(device_,
- surface_->GetHandle(),
- allocation_.width(),
- allocation_.height());
- cairo_surface_set_user_data(cairo_surface_,
- &surface_data_key_,
- this,
- NULL);
- }
-
- delegate_->OnNativeWidgetCreated();
-
- if (params.type != Widget::InitParams::TYPE_TOOLTIP) {
- // TODO(dnicoara) Enable this once it works with Wayland
- /*
- views::TooltipManagerViews* manager = new views::TooltipManagerViews(
- static_cast<internal::RootView*>(GetWidget()->GetRootView()));
- tooltip_manager_.reset(manager);
- */
- }
-
- // TODO(dnicoara) This should be removed when we can specify the (x, y)
- // coordinates for a window. We use fullscreen since it will center the
- // window rather than give it random (x, y) coordinates.
- wayland_window_->set_fullscreen(true);
- Show();
- OnPaint(allocation_);
-}
-
-NonClientFrameView* NativeWidgetWayland::CreateNonClientFrameView() {
- return NULL;
-}
-
-void NativeWidgetWayland::UpdateFrameAfterFrameChange() {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetWayland::ShouldUseNativeFrame() const {
- NOTIMPLEMENTED();
- return false;
-}
-
-void NativeWidgetWayland::FrameTypeChanged() {
- // Called when the Theme has changed, so forward the event to the root
- // widget
- GetWidget()->ThemeChanged();
- GetWidget()->GetRootView()->SchedulePaint();
-}
-
-Widget* NativeWidgetWayland::GetWidget() {
- return delegate_->AsWidget();
-}
-
-const Widget* NativeWidgetWayland::GetWidget() const {
- return delegate_->AsWidget();
-}
-
-gfx::NativeView NativeWidgetWayland::GetNativeView() const {
- return wayland_window_;
-}
-
-gfx::NativeWindow NativeWidgetWayland::GetNativeWindow() const {
- return wayland_window_;
-}
-
-Widget* NativeWidgetWayland::GetTopLevelWidget() {
- NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView());
- return native_widget ? native_widget->GetWidget() : NULL;
-}
-
-const ui::Compositor* NativeWidgetWayland::GetCompositor() const {
- return compositor_.get();
-}
-
-ui::Compositor* NativeWidgetWayland::GetCompositor() {
- return compositor_.get();
-}
-
-void NativeWidgetWayland::CalculateOffsetToAncestorWithLayer(
- gfx::Point* offset,
- ui::Layer** layer_parent) {
-}
-
-void NativeWidgetWayland::ReorderLayers() {
-}
-
-void NativeWidgetWayland::ViewRemoved(View* view) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::SetNativeWindowProperty(const char* name,
- void* value) {
- // Remove the existing property (if any).
- for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) {
- if ((*i)->Key() == name) {
- props_.erase(i);
- break;
- }
- }
-
- if (value)
- props_.push_back(new ViewProp(wayland_window_, name, value));
-}
-
-void* NativeWidgetWayland::GetNativeWindowProperty(const char* name) const {
- return ViewProp::GetValue(wayland_window_, name);
-}
-
-TooltipManager* NativeWidgetWayland::GetTooltipManager() const {
- return tooltip_manager_.get();
-}
-
-bool NativeWidgetWayland::IsScreenReaderActive() const {
- return false;
-}
-
-void NativeWidgetWayland::SendNativeAccessibilityEvent(
- View* view,
- ui::AccessibilityTypes::Event event_type) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::SetMouseCapture() {
- NOTIMPLEMENTED();
- has_mouse_capture_ = true;
-}
-
-void NativeWidgetWayland::ReleaseMouseCapture() {
- NOTIMPLEMENTED();
- has_mouse_capture_ = false;
-}
-
-bool NativeWidgetWayland::HasMouseCapture() const {
- NOTIMPLEMENTED();
- return has_mouse_capture_;
-}
-
-InputMethod* NativeWidgetWayland::CreateInputMethod() {
- return new InputMethodWayland(this);
-}
-
-void NativeWidgetWayland::CenterWindow(const gfx::Size& size) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::GetWindowPlacement(
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::SetWindowTitle(const string16& title) {
-}
-
-void NativeWidgetWayland::SetWindowIcons(const SkBitmap& window_icon,
- const SkBitmap& app_icon) {
-}
-
-void NativeWidgetWayland::SetAccessibleName(const string16& name) {
-}
-
-void NativeWidgetWayland::SetAccessibleRole(
- ui::AccessibilityTypes::Role role) {
-}
-
-void NativeWidgetWayland::SetAccessibleState(
- ui::AccessibilityTypes::State state) {
-}
-
-void NativeWidgetWayland::BecomeModal() {
- NOTIMPLEMENTED();
-}
-
-gfx::Rect NativeWidgetWayland::GetWindowScreenBounds() const {
- return GetClientAreaScreenBounds();
-}
-
-gfx::Rect NativeWidgetWayland::GetClientAreaScreenBounds() const {
- return allocation_;
-}
-
-gfx::Rect NativeWidgetWayland::GetRestoredBounds() const {
- return GetWindowScreenBounds();
-}
-
-void NativeWidgetWayland::SetBounds(const gfx::Rect& bounds) {
- saved_allocation_ = allocation_;
- allocation_ = bounds;
-
- // TODO(dnicoara) This needs to be updated to include (x, y).
- wl_egl_window_resize(egl_window_,
- allocation_.width(),
- allocation_.height(),
- 0, 0);
- if (!View::get_use_acceleration_when_possible()) {
- cairo_gl_surface_set_size(cairo_surface_,
- allocation_.width(),
- allocation_.height());
- }
-
- if (compositor_.get())
- compositor_->WidgetSizeChanged(allocation_.size());
- delegate_->OnNativeWidgetSizeChanged(allocation_.size());
-}
-
-void NativeWidgetWayland::SetSize(const gfx::Size& size) {
- gfx::Rect new_alloc = allocation_;
- new_alloc.set_size(size);
-
- SetBounds(new_alloc);
-}
-
-void NativeWidgetWayland::MoveAbove(gfx::NativeView native_view) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::MoveToTop() {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::SetShape(gfx::NativeRegion shape) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::Close() {
- Hide();
- if (!close_widget_factory_.HasWeakPtrs()) {
- MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&NativeWidgetWayland::CloseNow,
- close_widget_factory_.GetWeakPtr()));
- }
-}
-
-void NativeWidgetWayland::CloseNow() {
- delegate_->OnNativeWidgetDestroying();
- delegate_->OnNativeWidgetDestroyed();
- if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
- delete this;
-}
-
-void NativeWidgetWayland::EnableClose(bool enable) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::Show() {
- wayland_window_->SetVisible(true);
- delegate_->OnNativeWidgetVisibilityChanged(true);
-}
-
-void NativeWidgetWayland::Hide() {
- wayland_window_->SetVisible(false);
- delegate_->OnNativeWidgetVisibilityChanged(false);
-}
-
-void NativeWidgetWayland::ShowMaximizedWithBounds(
- const gfx::Rect& restored_bounds) {
- Show();
- Maximize();
- saved_allocation_ = restored_bounds;
-}
-
-void NativeWidgetWayland::ShowWithWindowState(ui::WindowShowState state) {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetWayland::IsVisible() const {
- return wayland_window_->IsVisible();
-}
-
-void NativeWidgetWayland::Activate() {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::Deactivate() {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetWayland::IsActive() const {
- NOTIMPLEMENTED();
- return true;
-}
-
-void NativeWidgetWayland::SetAlwaysOnTop(bool always_on_top) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::Maximize() {
- std::list<ui::WaylandScreen*> screens = wayland_display_->GetScreenList();
-
- if (screens.empty())
- return;
-
- // TODO(dnicoara) We need to intersect the current coordinates with the
- // screen ones and decide the correct screen to fullscreen on.
- ui::WaylandScreen* screen = screens.front();
-
- SetBounds(screen->GetAllocation());
-}
-
-void NativeWidgetWayland::Minimize() {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetWayland::IsMaximized() const {
- NOTIMPLEMENTED();
- return true;
-}
-
-bool NativeWidgetWayland::IsMinimized() const {
- NOTIMPLEMENTED();
- return false;
-}
-
-void NativeWidgetWayland::Restore() {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::SetFullscreen(bool fullscreen) {
- gfx::Rect new_allocation = allocation_;
-
- if (fullscreen) {
- std::list<ui::WaylandScreen*> screens = wayland_display_->GetScreenList();
-
- if (screens.empty())
- return;
-
- // TODO(dnicoara) What does it mean to be fullscreen when having multiple
- // monitors? If we're going fullscreen only on one screen then we need to
- // intersect the current coordinates with the screen ones and decide the
- // correct screen to fullscreen on.
- ui::WaylandScreen* screen = screens.front();
- new_allocation = screen->GetAllocation();
- } else {
- new_allocation = saved_allocation_;
- }
-
- wayland_window_->set_fullscreen(fullscreen);
- SetBounds(new_allocation);
-}
-
-bool NativeWidgetWayland::IsFullscreen() const {
- return wayland_window_->fullscreen();
-}
-
-void NativeWidgetWayland::SetOpacity(unsigned char opacity) {
- NOTIMPLEMENTED();
-}
-
-void NativeWidgetWayland::SetUseDragFrame(bool use_drag_frame) {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetWayland::IsAccessibleWidget() const {
- NOTIMPLEMENTED();
- return true;
-}
-
-void NativeWidgetWayland::RunShellDrag(View* view,
- const ui::OSExchangeData& data,
- int operation) {
- NOTIMPLEMENTED();
-}
-
-gboolean NativeWidgetWayland::IdleRedraw(void* ptr) {
- NativeWidgetWayland* widget = static_cast<NativeWidgetWayland*>(ptr);
- gfx::Rect damage_area = widget->damage_area_;
- widget->damage_area_ = gfx::Rect();
-
- widget->OnPaint(damage_area);
-
- return FALSE;
-}
-
-void NativeWidgetWayland::SchedulePaintInRect(const gfx::Rect& rect) {
- if (damage_area_.IsEmpty())
- g_idle_add(NativeWidgetWayland::IdleRedraw, this);
-
- damage_area_ = damage_area_.Union(rect);
-}
-
-void NativeWidgetWayland::SetCursor(gfx::NativeCursor cursor) {
- NOTIMPLEMENTED();
-}
-
-
-void NativeWidgetWayland::ClearNativeFocus() {
- NOTIMPLEMENTED();
-}
-
-
-void NativeWidgetWayland::FocusNativeView(gfx::NativeView native_view) {
- NOTIMPLEMENTED();
-}
-
-bool NativeWidgetWayland::ConvertPointFromAncestor(
- const Widget* ancestor, gfx::Point* point) const {
- NOTREACHED();
- return false;
-}
-
-void NativeWidgetWayland::ScheduleDraw() {
- SchedulePaintInRect(allocation_);
-}
-
-// Overridden from NativeWidget
-gfx::AcceleratedWidget NativeWidgetWayland::GetAcceleratedWidget() {
- return egl_window_;
-}
-
-
-// Overridden from internal::InputMethodDelegate
-void NativeWidgetWayland::DispatchKeyEventPostIME(const KeyEvent& key) {
- NOTIMPLEMENTED();
- delegate_->OnKeyEvent(key);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// NativeWidgetWayland, private, event handlers
-
-void NativeWidgetWayland::OnPaint(gfx::Rect damage_area) {
- if (!delegate_->OnNativeWidgetPaintAccelerated(damage_area)) {
- // This is required since the CanvasSkiaPaint damages the surface
- // in the destructor so we need to have this done before calling
- // swapbuffers.
- {
- cairo_rectangle_int_t region = damage_area.ToCairoRectangle();
- gfx::CanvasSkiaPaint canvas(cairo_surface_, &region);
- if (!canvas.is_empty()) {
- canvas.set_composite_alpha(false);
- delegate_->OnNativeWidgetPaint(&canvas);
- }
- }
-
- // Have cairo swap buffers, then let Wayland know of the damaged area.
- cairo_gl_surface_swapbuffers(cairo_surface_);
- wl_surface_damage(wayland_window_->surface(),
- damage_area.x(), damage_area.y(),
- damage_area.width(), damage_area.height());
- }
-}
-
-void NativeWidgetWayland::OnMotionNotify(WaylandEvent event) {
- MouseEvent mouse_event(&event);
- delegate_->OnMouseEvent(mouse_event);
-}
-
-void NativeWidgetWayland::OnButtonNotify(WaylandEvent event) {
- if (event.button.button == ui::SCROLL_UP ||
- event.button.button == ui::SCROLL_DOWN) {
- MouseWheelEvent mouse_event(&event);
- delegate_->OnMouseEvent(mouse_event);
- } else {
- MouseEvent mouse_event(&event);
- delegate_->OnMouseEvent(mouse_event);
- }
-}
-
-void NativeWidgetWayland::OnKeyNotify(WaylandEvent event) {
- KeyEvent key_event(&event);
- InputMethod* input_method = GetWidget()->GetInputMethodDirect();
- if (input_method)
- input_method->DispatchKeyEvent(key_event);
- else
- DispatchKeyEventPostIME(key_event);
-}
-
-void NativeWidgetWayland::OnPointerFocus(WaylandEvent event) {
- MouseEvent mouse_event(&event);
- delegate_->OnMouseEvent(mouse_event);
-}
-
-void NativeWidgetWayland::OnKeyboardFocus(WaylandEvent event) {
- InputMethod* input_method = GetWidget()->GetInputMethodDirect();
- if (input_method) {
- if (event.keyboard_focus.state)
- input_method->OnFocus();
- else
- input_method->OnBlur();
- }
-}
-
-void NativeWidgetWayland::OnGeometryChange(WaylandEvent event) {
- SetSize(gfx::Size(event.geometry_change.width,
- event.geometry_change.height));
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Widget
-
-// static
-bool Widget::ConvertRect(const Widget* source,
- const Widget* target,
- gfx::Rect* rect) {
- DCHECK(source);
- DCHECK(target);
- DCHECK(rect);
-
- gfx::NativeView source_widget = source->GetNativeView();
- gfx::NativeView target_widget = target->GetNativeView();
- if (source_widget == target_widget)
- return true;
-
- if (!source_widget || !target_widget)
- return false;
-
- NOTIMPLEMENTED();
- return false;
-}
-
-namespace internal {
-
-/////////////////////////////////////////////////////////////////////////////
-// NativeWidget
-
-// static
-NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget(
- internal::NativeWidgetDelegate* delegate) {
- if (Widget::IsPureViews() &&
- ViewsDelegate::views_delegate->GetDefaultParentView()) {
- return new NativeWidgetViews(delegate);
- }
- return new NativeWidgetWayland(delegate);
-}
-
-// static
-NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView(
- gfx::NativeView native_view) {
- return reinterpret_cast<NativeWidgetWayland*>(
- ViewProp::GetValue(native_view, kNativeWidgetKey));
-}
-
-// static
-NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow(
- gfx::NativeWindow native_window) {
- return GetNativeWidgetForNativeView(native_window);
-}
-
-// static
-NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget(
- gfx::NativeView native_view) {
- // TODO(dnicoara) What would be the best way to implement this?
- // Since there isn't any actual parenting concept in Wayland, we could
- // implement it using WaylandWindow->SetParent/GetParent calls.
- return GetNativeWidgetForNativeView(native_view);
-}
-
-// static
-void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view,
- Widget::Widgets* children) {
- NOTIMPLEMENTED();
- if (!native_view)
- return;
-}
-
-// static
-void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
- gfx::NativeView new_parent) {
- NOTIMPLEMENTED();
- if (!native_view)
- return;
-}
-
-// static
-bool NativeWidgetPrivate::IsMouseButtonDown() {
- NOTIMPLEMENTED();
- return false;
-}
-
-} // namespace internal
-
-} // namespace views
diff --git a/views/widget/native_widget_wayland.h b/views/widget/native_widget_wayland.h
deleted file mode 100644
index 0632c1a..0000000
--- a/views/widget/native_widget_wayland.h
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WIDGET_WAYLAND_H_
-#define VIEWS_WIDGET_NATIVE_WIDGET_WAYLAND_H_
-#pragma once
-
-#include <wayland-client.h>
-
-#include "base/memory/scoped_vector.h"
-#include "base/memory/weak_ptr.h"
-#include "ui/gfx/compositor/compositor.h"
-#include "ui/gfx/gl/gl_context.h"
-#include "ui/gfx/gl/gl_surface.h"
-#include "ui/gfx/size.h"
-#include "ui/wayland/wayland_widget.h"
-#include "views/widget/native_widget_private.h"
-#include "views/widget/widget.h"
-
-typedef struct _cairo_device cairo_device_t;
-typedef struct _cairo_surface cairo_surface_t;
-
-namespace base {
-namespace wayland {
-union WaylandEvent;
-}
-}
-
-namespace gfx {
-class Rect;
-}
-
-namespace ui {
-class ViewProp;
-class WaylandDisplay;
-class WaylandWindow;
-}
-
-namespace views {
-
-namespace internal {
-class NativeWidgetDelegate;
-}
-
-// Widget implementation for Wayland
-class NativeWidgetWayland : public internal::NativeWidgetPrivate,
- public ui::CompositorDelegate,
- public ui::WaylandWidget {
- public:
- explicit NativeWidgetWayland(internal::NativeWidgetDelegate* delegate);
- virtual ~NativeWidgetWayland();
-
- // Overridden from NativeWidget:
- virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE;
- virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
- virtual void UpdateFrameAfterFrameChange() OVERRIDE;
- virtual bool ShouldUseNativeFrame() const OVERRIDE;
- virtual void FrameTypeChanged() OVERRIDE;
- virtual Widget* GetWidget() OVERRIDE;
- virtual const Widget* GetWidget() const OVERRIDE;
- virtual gfx::NativeView GetNativeView() const OVERRIDE;
- virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual Widget* GetTopLevelWidget() OVERRIDE;
- virtual const ui::Compositor* GetCompositor() const OVERRIDE;
- virtual ui::Compositor* GetCompositor() OVERRIDE;
- virtual void CalculateOffsetToAncestorWithLayer(
- gfx::Point* offset,
- ui::Layer** layer_parent) OVERRIDE;
- virtual void ReorderLayers() OVERRIDE;
- virtual void ViewRemoved(View* view) OVERRIDE;
- virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
- virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
- virtual TooltipManager* GetTooltipManager() const OVERRIDE;
- virtual bool IsScreenReaderActive() const OVERRIDE;
- virtual void SendNativeAccessibilityEvent(
- View* view,
- ui::AccessibilityTypes::Event event_type) OVERRIDE;
- virtual void SetMouseCapture() OVERRIDE;
- virtual void ReleaseMouseCapture() OVERRIDE;
- virtual bool HasMouseCapture() const OVERRIDE;
- virtual InputMethod* CreateInputMethod() OVERRIDE;
- virtual void CenterWindow(const gfx::Size& size) OVERRIDE;
- virtual void GetWindowPlacement(
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const OVERRIDE;
- virtual void SetWindowTitle(const string16& title) OVERRIDE;
- virtual void SetWindowIcons(const SkBitmap& window_icon,
- const SkBitmap& app_icon) OVERRIDE;
- virtual void SetAccessibleName(const string16& name) OVERRIDE;
- virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
- virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
- virtual void BecomeModal() OVERRIDE;
- virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
- virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
- virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
- virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
- virtual void SetSize(const gfx::Size& size) OVERRIDE;
- virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE;
- virtual void MoveToTop() OVERRIDE;
- virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
- virtual void Close() OVERRIDE;
- virtual void CloseNow() OVERRIDE;
- virtual void EnableClose(bool enable) OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual void ShowMaximizedWithBounds(
- const gfx::Rect& restored_bounds) OVERRIDE;
- virtual void ShowWithWindowState(ui::WindowShowState window_state) OVERRIDE;
- virtual bool IsVisible() const OVERRIDE;
- virtual void Activate() OVERRIDE;
- virtual void Deactivate() OVERRIDE;
- virtual bool IsActive() const OVERRIDE;
- virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
- virtual void Maximize() OVERRIDE;
- virtual void Minimize() OVERRIDE;
- virtual bool IsMaximized() const OVERRIDE;
- virtual bool IsMinimized() const OVERRIDE;
- virtual void Restore() OVERRIDE;
- virtual void SetFullscreen(bool fullscreen) OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
- virtual void SetOpacity(unsigned char opacity) OVERRIDE;
- virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
- virtual bool IsAccessibleWidget() const OVERRIDE;
- virtual void RunShellDrag(View* view,
- const ui::OSExchangeData& data,
- int operation) OVERRIDE;
- virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE;
- virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
- virtual void ClearNativeFocus() OVERRIDE;
- virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE;
- virtual bool ConvertPointFromAncestor(
- const Widget* ancestor, gfx::Point* point) const OVERRIDE;
-
- virtual void OnMotionNotify(WaylandEvent event) OVERRIDE;
- virtual void OnButtonNotify(WaylandEvent event) OVERRIDE;
- virtual void OnKeyNotify(WaylandEvent event) OVERRIDE;
- virtual void OnPointerFocus(WaylandEvent event) OVERRIDE;
- virtual void OnKeyboardFocus(WaylandEvent event) OVERRIDE;
-
- virtual void OnGeometryChange(WaylandEvent event) OVERRIDE;
-
- private:
- typedef ScopedVector<ui::ViewProp> ViewProps;
-
- // Overridden from ui::CompositorDelegate
- virtual void ScheduleDraw();
-
- // Overridden from NativeWidget
- virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
-
- // Overridden from internal::InputMethodDelegate
- virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
-
- void OnPaint(gfx::Rect damage_area);
-
- static gboolean IdleRedraw(void* ptr);
-
- // A delegate implementation that handles events received here.
- // See class documentation for Widget in widget.h for a note about ownership.
- internal::NativeWidgetDelegate* delegate_;
-
- scoped_ptr<TooltipManager> tooltip_manager_;
-
- // The following factory is used to delay destruction.
- base::WeakPtrFactory<NativeWidgetWayland> close_widget_factory_;
-
- // See class documentation for Widget in widget.h for a note about ownership.
- Widget::InitParams::Ownership ownership_;
-
- // Keeps track of mause capture for this widget.
- bool has_mouse_capture_;
-
- // Current window allocation
- gfx::Rect allocation_;
- // Previous allocation. Used to restore the size and location.
- gfx::Rect saved_allocation_;
-
- // The compositor for accelerated drawing.
- scoped_refptr<ui::Compositor> compositor_;
-
- ViewProps props_;
-
- // Pointer to the Wayland display. This object doesn't own the pointer.
- ui::WaylandDisplay* wayland_display_;
-
- // Wayland window associated with this widget.
- ui::WaylandWindow* wayland_window_;
-
- // The accelerated surface associated with a Wayland window.
- struct wl_egl_window* egl_window_;
-
- cairo_device_t* device_;
-
- // Cairo surface associated with the Wayland accelerated surface. This is
- // used when we're not using the accelerated painting path.
- cairo_surface_t* cairo_surface_;
- const cairo_user_data_key_t surface_data_key_;
-
- // Used to accumulate damaged area between repaints.
- // Necessary since Wayland seems to expect at most one paint per frame.
- gfx::Rect damage_area_;
-
- // The GL surface and context used to render when we're using unaccelerated
- // rendering. If we're using accelerated rendering, we'll have a compositor
- // and the compositor will have these, so we don't need to worry about them.
- scoped_refptr<gfx::GLSurface> surface_;
- scoped_refptr<gfx::GLContext> context_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWidgetWayland);
-};
-
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WIDGET_WAYLAND_H_
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index 2b512ea..7c013f9 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -45,7 +45,6 @@
#include "views/widget/drop_target_win.h"
#include "views/widget/monitor_win.h"
#include "views/widget/native_widget_delegate.h"
-#include "views/widget/native_widget_views.h"
#include "views/widget/root_view.h"
#include "views/widget/widget_delegate.h"
@@ -2412,10 +2411,6 @@ namespace internal {
// static
NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget(
internal::NativeWidgetDelegate* delegate) {
- if (Widget::IsPureViews() &&
- ViewsDelegate::views_delegate->GetDefaultParentView()) {
- return new NativeWidgetViews(delegate);
- }
return new NativeWidgetWin(delegate);
}
diff --git a/views/widget/widget_unittest.cc b/views/widget/widget_unittest.cc
index f4a72f9..736d699 100644
--- a/views/widget/widget_unittest.cc
+++ b/views/widget/widget_unittest.cc
@@ -2,15 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "views/widget/native_widget_views.h"
-
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/test/test_views_delegate.h"
#include "ui/views/test/views_test_base.h"
+#include "ui/gfx/point.h"
+#include "ui/gfx/native_widget_types.h"
#include "views/views_delegate.h"
+#include "views/widget/native_widget_delegate.h"
#if defined(USE_AURA)
#include "ui/aura/window.h"
@@ -24,14 +25,25 @@
namespace views {
namespace {
-#if defined(TOOLKIT_USES_GTK)
-// A widget that assumes mouse capture always works.
-class NativeWidgetGtkCapture : public NativeWidgetGtk {
+// A generic typedef to pick up relevant NativeWidget implementations.
+#if defined(USE_AURA)
+typedef NativeWidgetAura NativeWidgetPlatform;
+#elif defined(OS_WIN)
+typedef NativeWidgetWin NativeWidgetPlatform;
+#elif defined(TOOLKIT_USES_GTK)
+typedef NativeWidgetGtk NativeWidgetPlatform;
+#endif
+
+// A widget that assumes mouse capture always works. It won't on Gtk/Aura in
+// testing, so we mock it.
+#if defined(TOOLKIT_USES_GTK) || defined(USE_AURA)
+class NativeWidgetCapture : public NativeWidgetPlatform {
public:
- NativeWidgetGtkCapture(internal::NativeWidgetDelegate* delegate)
- : NativeWidgetGtk(delegate),
+ NativeWidgetCapture(internal::NativeWidgetDelegate* delegate)
+ : NativeWidgetPlatform(delegate),
mouse_capture_(false) {}
- virtual ~NativeWidgetGtkCapture() {}
+ virtual ~NativeWidgetCapture() {}
+
virtual void SetMouseCapture() OVERRIDE {
mouse_capture_ = true;
}
@@ -47,10 +59,20 @@ class NativeWidgetGtkCapture : public NativeWidgetGtk {
private:
bool mouse_capture_;
- DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtkCapture);
+ DISALLOW_COPY_AND_ASSIGN(NativeWidgetCapture);
};
#endif
+// A typedef that inserts our mock-capture NativeWidget implementation for
+// relevant platforms.
+#if defined(USE_AURA)
+typedef NativeWidgetCapture NativeWidgetPlatformForTest;
+#elif defined(OS_WIN)
+typedef NativeWidgetWin NativeWidgetPlatformForTest;
+#elif defined(TOOLKIT_USES_GTK)
+typedef NativeWidgetCapture NativeWidgetPlatformForTest;
+#endif
+
// A view that always processes all mouse events.
class MouseView : public View {
public:
@@ -63,56 +85,11 @@ class MouseView : public View {
}
};
-class WidgetTestViewsDelegate : public TestViewsDelegate {
- public:
- WidgetTestViewsDelegate() : default_parent_view_(NULL) {
- }
- virtual ~WidgetTestViewsDelegate() {}
-
- void set_default_parent_view(View* default_parent_view) {
- default_parent_view_ = default_parent_view;
- }
-
- // Overridden from TestViewsDelegate:
- virtual View* GetDefaultParentView() OVERRIDE {
- return default_parent_view_;
- }
-
- private:
- View* default_parent_view_;
-
- DISALLOW_COPY_AND_ASSIGN(WidgetTestViewsDelegate);
-};
-
-class WidgetTest : public ViewsTestBase {
- public:
- WidgetTest() {
- }
- virtual ~WidgetTest() {
- }
-
- virtual void SetUp() OVERRIDE {
- set_views_delegate(new WidgetTestViewsDelegate());
- ViewsTestBase::SetUp();
- }
-
- WidgetTestViewsDelegate& widget_views_delegate() const {
- return static_cast<WidgetTestViewsDelegate&>(views_delegate());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WidgetTest);
-};
+typedef ViewsTestBase WidgetTest;
NativeWidget* CreatePlatformNativeWidget(
internal::NativeWidgetDelegate* delegate) {
-#if defined(USE_AURA)
- return new NativeWidgetAura(delegate);
-#elif defined(OS_WIN)
- return new NativeWidgetWin(delegate);
-#elif defined(TOOLKIT_USES_GTK)
- return new NativeWidgetGtkCapture(delegate);
-#endif
+ return new NativeWidgetPlatformForTest(delegate);
}
Widget* CreateTopLevelPlatformWidget() {
@@ -147,32 +124,30 @@ Widget* CreateChildPopupPlatformWidget(gfx::NativeView parent_native_view) {
}
#endif
-Widget* CreateTopLevelNativeWidgetViews() {
+Widget* CreateTopLevelNativeWidget() {
Widget* toplevel = new Widget;
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
- params.native_widget = new NativeWidgetViews(toplevel);
toplevel->Init(params);
toplevel->SetContentsView(new View);
return toplevel;
}
-Widget* CreateChildNativeWidgetViewsWithParent(Widget* parent) {
+Widget* CreateChildNativeWidgetWithParent(Widget* parent) {
Widget* child = new Widget;
Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
- params.native_widget = new NativeWidgetViews(child);
params.parent_widget = parent;
child->Init(params);
child->SetContentsView(new View);
return child;
}
-Widget* CreateChildNativeWidgetViews() {
- return CreateChildNativeWidgetViewsWithParent(NULL);
+Widget* CreateChildNativeWidget() {
+ return CreateChildNativeWidgetWithParent(NULL);
}
bool WidgetHasMouseCapture(const Widget* widget) {
return static_cast<const internal::NativeWidgetPrivate*>(widget->
- native_widget())-> HasMouseCapture();
+ native_widget())->HasMouseCapture();
}
////////////////////////////////////////////////////////////////////////////////
@@ -199,10 +174,9 @@ TEST_F(WidgetTest, GetTopLevelWidget_Native) {
TEST_F(WidgetTest, GetTopLevelWidget_Synthetic) {
// Create a hierarchy consisting of a top level platform native widget and a
- // child NativeWidgetViews.
+ // child NativeWidget.
Widget* toplevel = CreateTopLevelPlatformWidget();
- widget_views_delegate().set_default_parent_view(toplevel->GetRootView());
- Widget* child = CreateTopLevelNativeWidgetViews();
+ Widget* child = CreateTopLevelNativeWidget();
EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget());
EXPECT_EQ(child, child->GetTopLevelWidget());
@@ -212,18 +186,16 @@ TEST_F(WidgetTest, GetTopLevelWidget_Synthetic) {
}
// Creates a hierarchy consisting of a desktop platform native widget, a
-// toplevel NativeWidgetViews, and a child of that toplevel, another
-// NativeWidgetViews.
+// toplevel NativeWidget, and a child of that toplevel, another NativeWidget.
TEST_F(WidgetTest, GetTopLevelWidget_SyntheticDesktop) {
// Create a hierarchy consisting of a desktop platform native widget,
- // a toplevel NativeWidgetViews and a chlid NativeWidgetViews.
+ // a toplevel NativeWidget and a chlid NativeWidget.
Widget* desktop = CreateTopLevelPlatformWidget();
- widget_views_delegate().set_default_parent_view(desktop->GetRootView());
- Widget* toplevel = CreateTopLevelNativeWidgetViews(); // Will be parented
- // automatically to
- // |toplevel|.
+ Widget* toplevel = CreateTopLevelNativeWidget(); // Will be parented
+ // automatically to
+ // |toplevel|.
- Widget* child = CreateChildNativeWidgetViewsWithParent(toplevel);
+ Widget* child = CreateChildNativeWidgetWithParent(toplevel);
EXPECT_EQ(desktop, desktop->GetTopLevelWidget());
EXPECT_EQ(toplevel, toplevel->GetTopLevelWidget());
@@ -233,17 +205,11 @@ TEST_F(WidgetTest, GetTopLevelWidget_SyntheticDesktop) {
// |toplevel|, |child| should be automatically destroyed with |toplevel|.
}
-// This is flaky on touch build. See crbug.com/94137.
-#if defined(TOUCH_UI)
-#define MAYBE_GrabUngrab DISABLED_GrabUngrab
-#else
-#define MAYBE_GrabUngrab GrabUngrab
-#endif
// Tests some grab/ungrab events.
-TEST_F(WidgetTest, MAYBE_GrabUngrab) {
+TEST_F(WidgetTest, DISABLED_GrabUngrab) {
Widget* toplevel = CreateTopLevelPlatformWidget();
- Widget* child1 = CreateChildNativeWidgetViewsWithParent(toplevel);
- Widget* child2 = CreateChildNativeWidgetViewsWithParent(toplevel);
+ Widget* child1 = CreateChildNativeWidgetWithParent(toplevel);
+ Widget* child2 = CreateChildNativeWidgetWithParent(toplevel);
toplevel->SetBounds(gfx::Rect(0, 0, 500, 500));
@@ -379,16 +345,15 @@ TEST_F(WidgetTest, Visibility_ChildPopup) {
// Tests visibility of synthetic child widgets.
TEST_F(WidgetTest, Visibility_Synthetic) {
// Create a hierarchy consisting of a desktop platform native widget,
- // a toplevel NativeWidgetViews and a chlid NativeWidgetViews.
+ // a toplevel NativeWidget and a chlid NativeWidget.
Widget* desktop = CreateTopLevelPlatformWidget();
desktop->Show();
- widget_views_delegate().set_default_parent_view(desktop->GetRootView());
- Widget* toplevel = CreateTopLevelNativeWidgetViews(); // Will be parented
- // automatically to
- // |toplevel|.
+ Widget* toplevel = CreateTopLevelNativeWidget(); // Will be parented
+ // automatically to
+ // |toplevel|.
- Widget* child = CreateChildNativeWidgetViewsWithParent(toplevel);
+ Widget* child = CreateChildNativeWidgetWithParent(toplevel);
EXPECT_FALSE(toplevel->IsVisible());
EXPECT_FALSE(child->IsVisible());
@@ -412,8 +377,7 @@ TEST_F(WidgetTest, Visibility_Synthetic) {
// Tests various permutations of Widget ownership specified in the
// InitParams::Ownership param.
-// A WidgetTest that supplies a toplevel widget for NativeWidgetViews to parent
-// to.
+// A WidgetTest that supplies a toplevel widget for NativeWidget to parent to.
class WidgetOwnershipTest : public WidgetTest {
public:
WidgetOwnershipTest() {}
@@ -422,8 +386,6 @@ class WidgetOwnershipTest : public WidgetTest {
virtual void SetUp() {
WidgetTest::SetUp();
desktop_widget_ = CreateTopLevelPlatformWidget();
- widget_views_delegate().set_default_parent_view(
- desktop_widget_->GetRootView());
}
virtual void TearDown() {
@@ -447,25 +409,12 @@ struct OwnershipTestState {
// A platform NativeWidget subclass that updates a bag of state when it is
// destroyed.
-class OwnershipTestNativeWidget :
-#if defined(USE_AURA)
- public NativeWidgetAura {
-#elif defined(OS_WIN)
- public NativeWidgetWin {
-#elif defined(TOOLKIT_USES_GTK)
- public NativeWidgetGtk {
-#endif
-public:
+class OwnershipTestNativeWidget : public NativeWidgetPlatform {
+ public:
OwnershipTestNativeWidget(internal::NativeWidgetDelegate* delegate,
OwnershipTestState* state)
-#if defined(USE_AURA)
- : NativeWidgetAura(delegate),
-#elif defined(OS_WIN)
- : NativeWidgetWin(delegate),
-#elif defined(TOOLKIT_USES_GTK)
- : NativeWidgetGtk(delegate),
-#endif
- state_(state) {
+ : NativeWidgetPlatform(delegate),
+ state_(state) {
}
virtual ~OwnershipTestNativeWidget() {
state_->native_widget_deleted = true;
@@ -479,21 +428,21 @@ public:
// A views NativeWidget subclass that updates a bag of state when it is
// destroyed.
-class OwnershipTestNativeWidgetViews : public NativeWidgetViews {
+class OwnershipTestNativeWidgetPlatform : public NativeWidgetPlatformForTest {
public:
- OwnershipTestNativeWidgetViews(internal::NativeWidgetDelegate* delegate,
- OwnershipTestState* state)
- : NativeWidgetViews(delegate),
+ OwnershipTestNativeWidgetPlatform(internal::NativeWidgetDelegate* delegate,
+ OwnershipTestState* state)
+ : NativeWidgetPlatformForTest(delegate),
state_(state) {
}
- virtual ~OwnershipTestNativeWidgetViews() {
+ virtual ~OwnershipTestNativeWidgetPlatform() {
state_->native_widget_deleted = true;
}
private:
OwnershipTestState* state_;
- DISALLOW_COPY_AND_ASSIGN(OwnershipTestNativeWidgetViews);
+ DISALLOW_COPY_AND_ASSIGN(OwnershipTestNativeWidgetPlatform);
};
// A Widget subclass that updates a bag of state when it is destroyed.
@@ -517,7 +466,8 @@ TEST_F(WidgetOwnershipTest, Ownership_WidgetOwnsPlatformNativeWidget) {
scoped_ptr<Widget> widget(new OwnershipTestWidget(&state));
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidget(widget.get(), &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget.get(), &state);
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
@@ -531,14 +481,14 @@ TEST_F(WidgetOwnershipTest, Ownership_WidgetOwnsPlatformNativeWidget) {
// being deleted out from under the Widget.
}
-// Widget owns its NativeWidget, part 2: NativeWidget is a NativeWidgetViews.
+// Widget owns its NativeWidget, part 2: NativeWidget is a NativeWidget.
TEST_F(WidgetOwnershipTest, Ownership_WidgetOwnsViewsNativeWidget) {
OwnershipTestState state;
scoped_ptr<Widget> widget(new OwnershipTestWidget(&state));
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
params.native_widget =
- new OwnershipTestNativeWidgetViews(widget.get(), &state);
+ new OwnershipTestNativeWidgetPlatform(widget.get(), &state);
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
@@ -552,7 +502,7 @@ TEST_F(WidgetOwnershipTest, Ownership_WidgetOwnsViewsNativeWidget) {
// being deleted out from under the Widget.
}
-// Widget owns its NativeWidget, part 3: NativeWidget is a NativeWidgetViews,
+// Widget owns its NativeWidget, part 3: NativeWidget is a NativeWidget,
// destroy the parent view.
TEST_F(WidgetOwnershipTest,
Ownership_WidgetOwnsViewsNativeWidget_DestroyParentView) {
@@ -562,8 +512,8 @@ TEST_F(WidgetOwnershipTest,
scoped_ptr<Widget> widget(new OwnershipTestWidget(&state));
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidgetViews(widget.get(),
- &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget.get(), &state);
params.parent_widget = toplevel;
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
@@ -592,7 +542,8 @@ TEST_F(WidgetOwnershipTest, Ownership_PlatformNativeWidgetOwnsWidget) {
Widget* widget = new OwnershipTestWidget(&state);
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidget(widget, &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget, &state);
widget->Init(params);
// Now destroy the native widget.
@@ -602,7 +553,7 @@ TEST_F(WidgetOwnershipTest, Ownership_PlatformNativeWidgetOwnsWidget) {
EXPECT_TRUE(state.native_widget_deleted);
}
-// NativeWidget owns its Widget, part 2: NativeWidget is a NativeWidgetViews.
+// NativeWidget owns its Widget, part 2: NativeWidget is a NativeWidget.
TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget) {
OwnershipTestState state;
@@ -610,16 +561,16 @@ TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget) {
Widget* widget = new OwnershipTestWidget(&state);
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidgetViews(widget, &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget, &state);
params.parent_widget = toplevel;
widget->Init(params);
// Now destroy the native widget. This is achieved by closing the toplevel.
toplevel->CloseNow();
- // The NativeWidgetViews won't be deleted until after a return to the message
- // loop so we have to run pending messages before testing the destruction
- // status.
+ // The NativeWidget won't be deleted until after a return to the message loop
+ // so we have to run pending messages before testing the destruction status.
RunPendingMessages();
EXPECT_TRUE(state.widget_deleted);
@@ -634,7 +585,8 @@ TEST_F(WidgetOwnershipTest,
Widget* widget = new OwnershipTestWidget(&state);
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidget(widget, &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget, &state);
widget->Init(params);
// Now simulate a destroy of the platform native widget from the OS:
@@ -650,7 +602,7 @@ TEST_F(WidgetOwnershipTest,
EXPECT_TRUE(state.native_widget_deleted);
}
-// NativeWidget owns its Widget, part 4: NativeWidget is a NativeWidgetViews,
+// NativeWidget owns its Widget, part 4: NativeWidget is a NativeWidget,
// destroyed by the view hierarchy that contains it.
TEST_F(WidgetOwnershipTest,
Ownership_ViewsNativeWidgetOwnsWidget_NativeDestroy) {
@@ -660,23 +612,23 @@ TEST_F(WidgetOwnershipTest,
Widget* widget = new OwnershipTestWidget(&state);
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidgetViews(widget, &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget, &state);
params.parent_widget = toplevel;
widget->Init(params);
// Destroy the widget (achieved by closing the toplevel).
toplevel->CloseNow();
- // The NativeWidgetViews won't be deleted until after a return to the message
- // loop so we have to run pending messages before testing the destruction
- // status.
+ // The NativeWidget won't be deleted until after a return to the message loop
+ // so we have to run pending messages before testing the destruction status.
RunPendingMessages();
EXPECT_TRUE(state.widget_deleted);
EXPECT_TRUE(state.native_widget_deleted);
}
-// NativeWidget owns its Widget, part 5: NativeWidget is a NativeWidgetViews,
+// NativeWidget owns its Widget, part 5: NativeWidget is a NativeWidget,
// we close it directly.
TEST_F(WidgetOwnershipTest,
Ownership_ViewsNativeWidgetOwnsWidget_Close) {
@@ -686,7 +638,8 @@ TEST_F(WidgetOwnershipTest,
Widget* widget = new OwnershipTestWidget(&state);
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
- params.native_widget = new OwnershipTestNativeWidgetViews(widget, &state);
+ params.native_widget =
+ new OwnershipTestNativeWidgetPlatform(widget, &state);
params.parent_widget = toplevel;
widget->Init(params);
@@ -694,9 +647,8 @@ TEST_F(WidgetOwnershipTest,
widget->Close();
toplevel->CloseNow();
- // The NativeWidgetViews won't be deleted until after a return to the message
- // loop so we have to run pending messages before testing the destruction
- // status.
+ // The NativeWidget won't be deleted until after a return to the message loop
+ // so we have to run pending messages before testing the destruction status.
RunPendingMessages();
EXPECT_TRUE(state.widget_deleted);
@@ -758,7 +710,7 @@ class WidgetObserverTest : public WidgetTest,
}
Widget* NewWidget() {
- Widget* widget = CreateTopLevelNativeWidgetViews();
+ Widget* widget = CreateTopLevelNativeWidget();
widget->AddObserver(this);
return widget;
}
@@ -781,9 +733,8 @@ class WidgetObserverTest : public WidgetTest,
Widget* widget_hidden_;
};
-TEST_F(WidgetObserverTest, ActivationChange) {
+TEST_F(WidgetObserverTest, DISABLED_ActivationChange) {
Widget* toplevel = CreateTopLevelPlatformWidget();
- widget_views_delegate().set_default_parent_view(toplevel->GetRootView());
Widget* toplevel1 = NewWidget();
Widget* toplevel2 = NewWidget();
@@ -807,9 +758,8 @@ TEST_F(WidgetObserverTest, ActivationChange) {
toplevel->CloseNow();
}
-TEST_F(WidgetObserverTest, VisibilityChange) {
+TEST_F(WidgetObserverTest, DISABLED_VisibilityChange) {
Widget* toplevel = CreateTopLevelPlatformWidget();
- widget_views_delegate().set_default_parent_view(toplevel->GetRootView());
Widget* child1 = NewWidget();
Widget* child2 = NewWidget();