diff options
author | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 21:42:02 +0000 |
---|---|---|
committer | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 21:42:02 +0000 |
commit | 3580aaf313e8fbfbec870e76a10a2461ab3f30c0 (patch) | |
tree | cebd7a2fe7a09cefacd6c0680b1e14d2e4ccb74e | |
parent | 60e9143637b518ac1d977c055922321082aaa818 (diff) | |
download | chromium_src-3580aaf313e8fbfbec870e76a10a2461ab3f30c0.zip chromium_src-3580aaf313e8fbfbec870e76a10a2461ab3f30c0.tar.gz chromium_src-3580aaf313e8fbfbec870e76a10a2461ab3f30c0.tar.bz2 |
Make aura_demo work on Mac
Fix a few instances where !Windows is assumed to be Linux.
Chang many instances of !USE_GTK_MESSAGE_PUMP &&
!OS_MACOSX && !OS_ANDROID to just USE_AURA (they are
equivalent now).
Add a very minimal RootWindowHostMac.
Of note is that building with Aura requires running
"gyp_chromium --no-circular-check" (the circular
check is only enabled on Mac, and doesn't work with
Aura).
Also note that the demo does not work properly unless BGRA
support is disabled (in FeatureInfo::InitializeBasicState these
extensions can be disabled).
BUG=331669
Review URL: https://codereview.chromium.org/110283005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243392 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/message_loop/message_loop.h | 6 | ||||
-rw-r--r-- | base/run_loop.cc | 6 | ||||
-rw-r--r-- | base/run_loop.h | 9 | ||||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 8 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 34 | ||||
-rw-r--r-- | chrome/chrome_browser_ui.gypi | 19 | ||||
-rw-r--r-- | ui/aura/aura.gyp | 2 | ||||
-rw-r--r-- | ui/aura/env.cc | 4 | ||||
-rw-r--r-- | ui/aura/env.h | 7 | ||||
-rw-r--r-- | ui/aura/root_window_host_mac.h | 63 | ||||
-rw-r--r-- | ui/aura/root_window_host_mac.mm | 122 | ||||
-rw-r--r-- | ui/aura/test/test_focus_client.h | 2 | ||||
-rw-r--r-- | ui/aura/window_tree_host.h | 1 | ||||
-rw-r--r-- | ui/base/clipboard/clipboard.h | 10 | ||||
-rw-r--r-- | ui/base/clipboard/clipboard_aura.cc | 2 | ||||
-rw-r--r-- | ui/base/clipboard/custom_data_helper.h | 2 | ||||
-rw-r--r-- | ui/base/clipboard/custom_data_helper_mac.mm | 4 | ||||
-rw-r--r-- | ui/base/cursor/cursor_mac.mm | 17 | ||||
-rw-r--r-- | ui/base/view_prop.h | 2 | ||||
-rw-r--r-- | ui/gfx/screen_mac.mm | 7 | ||||
-rw-r--r-- | ui/resources/ui_resources.grd | 2 | ||||
-rw-r--r-- | ui/ui.gyp | 4 | ||||
-rw-r--r-- | ui/ui_unittests.gyp | 1 |
23 files changed, 279 insertions, 55 deletions
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index f4ed5a1..04709e6 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -96,11 +96,11 @@ class WaitableEvent; class BASE_EXPORT MessageLoop : public MessagePump::Delegate { public: -#if defined(USE_GTK_MESSAGE_PUMP) - typedef MessagePumpGdkObserver Observer; -#elif !defined(OS_MACOSX) && !defined(OS_ANDROID) +#if defined(USE_AURA) typedef MessagePumpDispatcher Dispatcher; typedef MessagePumpObserver Observer; +#elif defined(USE_GTK_MESSAGE_PUMP) + typedef MessagePumpGdkObserver Observer; #endif // A MessageLoop has a particular type, which indicates the set of diff --git a/base/run_loop.cc b/base/run_loop.cc index 8666ee4..45723bb 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc @@ -17,14 +17,12 @@ RunLoop::RunLoop() running_(false), quit_when_idle_received_(false), weak_factory_(this) { -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) +#if defined(USE_AURA) dispatcher_ = NULL; #endif } -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) +#if defined(USE_AURA) RunLoop::RunLoop(MessageLoop::Dispatcher* dispatcher) : loop_(MessageLoop::current()), previous_run_loop_(NULL), diff --git a/base/run_loop.h b/base/run_loop.h index 0dce634..112bb79 100644 --- a/base/run_loop.h +++ b/base/run_loop.h @@ -27,14 +27,12 @@ class MessagePumpUIApplication; class BASE_EXPORT RunLoop { public: RunLoop(); -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) +#if defined(USE_AURA) explicit RunLoop(MessageLoop::Dispatcher* dispatcher); #endif ~RunLoop(); -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) +#if defined(USE_AURA) void set_dispatcher(MessageLoop::Dispatcher* dispatcher) { dispatcher_ = dispatcher; } @@ -97,8 +95,7 @@ class BASE_EXPORT RunLoop { // Parent RunLoop or NULL if this is the top-most RunLoop. RunLoop* previous_run_loop_; -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) +#if defined(USE_AURA) MessageLoop::Dispatcher* dispatcher_; #endif diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 58d36c6..5f2507a 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -631,7 +631,7 @@ </if> </if> </if> - <if expr="is_macosx or is_ios"> + <if expr="(is_macosx or is_ios) and not pp_ifdef('toolkit_views')"> <structure type="chrome_scaled_image" name="IDR_OTR_ICON" file="mac/otr_icon.png" /> </if> <if expr="context.startswith('default_')"> @@ -944,7 +944,7 @@ <structure type="chrome_scaled_image" name="IDR_TAB_ACTIVE_LEFT" file="common/tab_active_left.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_ACTIVE_RIGHT" file="common/tab_active_right.png" /> </if> - <if expr="is_macosx or is_ios"> + <if expr="(is_macosx or is_ios) and not pp_ifdef('toolkit_views')"> <structure type="chrome_scaled_image" name="IDR_TAB_ACTIVE_CENTER" file="mac/tab_active_center.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_ACTIVE_LEFT" file="mac/tab_active_left.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_ACTIVE_RIGHT" file="mac/tab_active_right.png" /> @@ -963,7 +963,7 @@ <structure type="chrome_scaled_image" name="IDR_TAB_ALPHA_LEFT" file="common/tab_alpha_left.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_ALPHA_RIGHT" file="common/tab_alpha_right.png" /> </if> - <if expr="is_macosx or is_ios"> + <if expr="(is_macosx or is_ios) and not pp_ifdef('toolkit_views')"> <structure type="chrome_scaled_image" name="IDR_TAB_ALPHA_LEFT" file="mac/tab_alpha_left.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_ALPHA_RIGHT" file="mac/tab_alpha_right.png" /> </if> @@ -985,7 +985,7 @@ <structure type="chrome_scaled_image" name="IDR_TAB_INACTIVE_LEFT" file="common/tab_inactive_left.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_INACTIVE_RIGHT" file="common/tab_inactive_right.png" /> </if> - <if expr="is_macosx or is_ios"> + <if expr="(is_macosx or is_ios) and not pp_ifdef('toolkit_views')"> <structure type="chrome_scaled_image" name="IDR_TAB_INACTIVE_CENTER" file="mac/tab_inactive_center.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_INACTIVE_LEFT" file="mac/tab_inactive_left.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_INACTIVE_RIGHT" file="mac/tab_inactive_right.png" /> diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index f7c893f..2e35645 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3336,7 +3336,7 @@ }], ], }, { # 'OS!="win" - 'sources/': [ + 'sources/': [ # Exclude files that should be excluded for all non-Windows platforms. ['exclude', '^browser/first_run/try_chrome_dialog_view.cc'], ['exclude', '^browser/first_run/try_chrome_dialog_view.h'], @@ -3347,10 +3347,6 @@ 'conditions': [ ['use_aura==1', { 'dependencies': [ - '../build/linux/system.gyp:dbus', - '../build/linux/system.gyp:fontconfig', - '../build/linux/system.gyp:x11', - '../dbus/dbus.gyp:dbus', '../ui/views/controls/webview/webview.gyp:webview', '../ui/views/views.gyp:views', ], @@ -3359,17 +3355,10 @@ '<(INTERMEDIATE_DIR)/chrome', ], 'sources/': [ - ['exclude', '^browser/platform_util_common_linux.cc'], ['include', '^browser/printing/print_dialog_cloud.cc'], ['include', '^browser/printing/print_dialog_cloud.h'], ], }], - # GTK build only - ['toolkit_uses_gtk==1', { - 'sources/': [ - ['exclude', '^browser/lifetime/application_lifetime_stub.cc'], - ], - }], ['gcc_version == 45', { # Avoid gcc 4.5 miscompilation of template_url.cc # as per http://crbug.com/41887 @@ -3379,6 +3368,27 @@ }], ], }], + ['OS=="linux"', { + 'conditions': [ + ['use_aura==1', { + 'dependencies': [ + '../build/linux/system.gyp:dbus', + '../build/linux/system.gyp:fontconfig', + '../build/linux/system.gyp:x11', + '../dbus/dbus.gyp:dbus', + ], + 'sources/': [ + ['exclude', '^browser/platform_util_common_linux.cc'], + ], + }], + # GTK build only + ['toolkit_uses_gtk==1', { + 'sources/': [ + ['exclude', '^browser/lifetime/application_lifetime_stub.cc'], + ], + }], + ], + }], ['enable_plugin_installation==0', { 'sources!': [ 'browser/plugins/plugin_installer.cc', diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 7c011e0..0605921 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -3273,12 +3273,8 @@ ['exclude', '^browser/ui/webui/set_as_default_browser_ui.h'], ], 'conditions': [ - ['use_aura==1',{ + ['use_aura==1', { 'dependencies': [ - '../build/linux/system.gyp:dbus', - '../build/linux/system.gyp:fontconfig', - '../build/linux/system.gyp:x11', - '../dbus/dbus.gyp:dbus', '../ui/views/controls/webview/webview.gyp:webview', '../ui/views/views.gyp:views', ], @@ -3287,6 +3283,7 @@ '<(INTERMEDIATE_DIR)/chrome', ], 'sources/': [ + ['exclude', '^browser/ui/cocoa/*'], ['exclude', '^browser/ui/views/frame/app_panel_browser_frame_view.cc'], ['exclude', '^browser/ui/views/frame/app_panel_browser_frame_view.h'], ['exclude', '^browser/ui/views/uninstall_view.cc'], @@ -3303,6 +3300,18 @@ ['exclude', '^browser/ui/views/'], ] }], + ], + }], + ['OS=="linux"', { + 'conditions': [ + ['use_aura==1', { + 'dependencies': [ + '../build/linux/system.gyp:dbus', + '../build/linux/system.gyp:fontconfig', + '../build/linux/system.gyp:x11', + '../dbus/dbus.gyp:dbus', + ], + }], # GTK build only ['toolkit_uses_gtk==1', { 'sources/': [ diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index ded1112..0464c7e 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -93,6 +93,8 @@ 'layout_manager.h', 'remote_root_window_host_win.cc', 'remote_root_window_host_win.h', + 'root_window_host_mac.mm', + 'root_window_host_mac.h', 'root_window_host_ozone.cc', 'root_window_host_ozone.h', 'root_window_host_win.cc', diff --git a/ui/aura/env.cc b/ui/aura/env.cc index 0982d91..4640b85 100644 --- a/ui/aura/env.cc +++ b/ui/aura/env.cc @@ -5,6 +5,7 @@ #include "ui/aura/env.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_dispatcher.h" #include "ui/aura/env_observer.h" #include "ui/aura/input_state_lookup.h" #include "ui/aura/window.h" @@ -75,8 +76,6 @@ bool Env::IsMouseButtonDown() const { mouse_button_flags_ != 0; } -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) base::MessageLoop::Dispatcher* Env::GetDispatcher() { #if defined(USE_X11) return base::MessagePumpX11::Current(); @@ -84,7 +83,6 @@ base::MessageLoop::Dispatcher* Env::GetDispatcher() { return dispatcher_.get(); #endif } -#endif void Env::RootWindowActivated(RootWindow* root_window) { FOR_EACH_OBSERVER(EnvObserver, observers_, diff --git a/ui/aura/env.h b/ui/aura/env.h index 4d3a477..6e64363 100644 --- a/ui/aura/env.h +++ b/ui/aura/env.h @@ -28,10 +28,8 @@ class InputStateLookup; class RootWindow; class Window; -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(USE_X11) // Creates a platform-specific native event dispatcher. base::MessageLoop::Dispatcher* CreateDispatcher(); -#endif // A singleton object that tracks general state within Aura. // TODO(beng): manage RootWindows. @@ -68,10 +66,7 @@ class AURA_EXPORT Env : public ui::EventTarget { // Returns the native event dispatcher. The result should only be passed to // base::RunLoop(dispatcher), or used to dispatch an event by // |Dispatch(const NativeEvent&)| on it. It must never be stored. -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(USE_GTK_MESSAGE_PUMP) base::MessageLoop::Dispatcher* GetDispatcher(); -#endif // Invoked by RootWindow when its host is activated. void RootWindowActivated(RootWindow* root_window); @@ -96,9 +91,7 @@ class AURA_EXPORT Env : public ui::EventTarget { virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; ObserverList<EnvObserver> observers_; -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(USE_X11) scoped_ptr<base::MessageLoop::Dispatcher> dispatcher_; -#endif static Env* instance_; int mouse_button_flags_; diff --git a/ui/aura/root_window_host_mac.h b/ui/aura/root_window_host_mac.h new file mode 100644 index 0000000..20454f0 --- /dev/null +++ b/ui/aura/root_window_host_mac.h @@ -0,0 +1,63 @@ +// Copyright 2014 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_AURA_ROOT_WINDOW_HOST_MAC_H_ +#define UI_AURA_ROOT_WINDOW_HOST_MAC_H_ + +#include <vector> + +#include "base/mac/scoped_nsobject.h" +#include "ui/aura/aura_export.h" +#include "ui/aura/window_tree_host.h" +#include "ui/gfx/insets.h" +#include "ui/gfx/rect.h" + +namespace ui { +class MouseEvent; +} + +namespace aura { + +namespace internal { +class TouchEventCalibrate; +} + +class AURA_EXPORT RootWindowHostMac : public RootWindowHost { + public: + explicit RootWindowHostMac(const gfx::Rect& bounds); + virtual ~RootWindowHostMac(); + + private: + // RootWindowHost Overrides. + virtual RootWindow* GetRootWindow() OVERRIDE; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; + virtual void Show() OVERRIDE; + virtual void Hide() OVERRIDE; + virtual void ToggleFullScreen() OVERRIDE; + virtual gfx::Rect GetBounds() const OVERRIDE; + virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; + virtual gfx::Insets GetInsets() const OVERRIDE; + virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; + virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; + virtual void SetCapture() OVERRIDE; + virtual void ReleaseCapture() OVERRIDE; + virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; + virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; + virtual bool ConfineCursorToRootWindow() OVERRIDE; + virtual void UnConfineCursor() OVERRIDE; + virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; + virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; + virtual void PrepareForShutdown() OVERRIDE; + + private: + base::scoped_nsobject<NSWindow> window_; + + DISALLOW_COPY_AND_ASSIGN(RootWindowHostMac); +}; + +} // namespace aura + +#endif // UI_AURA_ROOT_WINDOW_HOST_MAC_H_ diff --git a/ui/aura/root_window_host_mac.mm b/ui/aura/root_window_host_mac.mm new file mode 100644 index 0000000..b06f487 --- /dev/null +++ b/ui/aura/root_window_host_mac.mm @@ -0,0 +1,122 @@ +// Copyright 2014 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 <Cocoa/Cocoa.h> + +#include "ui/aura/root_window_host_mac.h" +#include "ui/aura/window_tree_host.h" +#include "ui/aura/window_tree_host_delegate.h" + +namespace aura { + +RootWindowHostMac::RootWindowHostMac(const gfx::Rect& bounds) { + window_.reset( + [[NSWindow alloc] + initWithContentRect:NSRectFromCGRect(bounds.ToCGRect()) + styleMask:NSBorderlessWindowMask + backing:NSBackingStoreBuffered + defer:NO]); + CreateCompositor(GetAcceleratedWidget()); +} + +RootWindowHostMac::~RootWindowHostMac() { +} + +RootWindow* RootWindowHostMac::GetRootWindow() { + return delegate_->AsRootWindow(); +} + +gfx::AcceleratedWidget RootWindowHostMac::GetAcceleratedWidget() { + return [window_ contentView]; +} +void RootWindowHostMac::Show() { + [window_ makeKeyAndOrderFront:nil]; +} + +void RootWindowHostMac::Hide() { + [window_ orderOut:nil]; +} + +void RootWindowHostMac::ToggleFullScreen() { +} + +gfx::Rect RootWindowHostMac::GetBounds() const { + return gfx::Rect(NSRectToCGRect([window_ frame])); +} + +void RootWindowHostMac::SetBounds(const gfx::Rect& bounds) { + [window_ setFrame:NSRectFromCGRect(bounds.ToCGRect()) display:YES animate:NO]; +} + +gfx::Insets RootWindowHostMac::GetInsets() const { + NOTIMPLEMENTED(); + return gfx::Insets(); +} + +void RootWindowHostMac::SetInsets(const gfx::Insets& insets) { + NOTIMPLEMENTED(); +} + +gfx::Point RootWindowHostMac::GetLocationOnNativeScreen() const { + NOTIMPLEMENTED(); + return gfx::Point(0, 0); +} + +void RootWindowHostMac::SetCapture() { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::ReleaseCapture() { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::SetCursor(gfx::NativeCursor cursor_type) { + NOTIMPLEMENTED(); +} + +bool RootWindowHostMac::QueryMouseLocation(gfx::Point* location_return) { + NOTIMPLEMENTED(); + return false; +} + +bool RootWindowHostMac::ConfineCursorToRootWindow() { + return false; +} + +void RootWindowHostMac::UnConfineCursor() { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::OnCursorVisibilityChanged(bool show) { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::MoveCursorTo(const gfx::Point& location) { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::PostNativeEvent(const base::NativeEvent& event) { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) { + NOTIMPLEMENTED(); +} + +void RootWindowHostMac::PrepareForShutdown() { + NOTIMPLEMENTED(); +} + +// static +RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { + return new RootWindowHostMac(bounds); +} + +// static +gfx::Size RootWindowHost::GetNativeScreenSize() { + NOTIMPLEMENTED(); + return gfx::Size(1024, 768); +} + +} // namespace aura diff --git a/ui/aura/test/test_focus_client.h b/ui/aura/test/test_focus_client.h index b58671f..06ae3c8 100644 --- a/ui/aura/test/test_focus_client.h +++ b/ui/aura/test/test_focus_client.h @@ -40,4 +40,4 @@ class TestFocusClient : public client::FocusClient, } // namespace test } // namespace aura -#endif // UI_AURA_TEST_TEST_FOCUS_CLIENT_H_
\ No newline at end of file +#endif // UI_AURA_TEST_TEST_FOCUS_CLIENT_H_ diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index ac18bfd..d437e0a 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h @@ -7,6 +7,7 @@ #include <vector> +#include "base/event_types.h" #include "base/message_loop/message_loop.h" #include "ui/aura/aura_export.h" #include "ui/base/cursor/cursor.h" diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h index 8b6e2ce..45dc127 100644 --- a/ui/base/clipboard/clipboard.h +++ b/ui/base/clipboard/clipboard.h @@ -90,12 +90,12 @@ class UI_BASE_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) { #if defined(OS_WIN) const FORMATETC& ToFormatEtc() const { return data_; } +#elif defined(USE_AURA) + const std::string& ToString() const { return data_; } #elif defined(OS_MACOSX) // Custom copy and assignment constructor to handle NSString. FormatType(const FormatType& other); FormatType& operator=(const FormatType& other); -#elif defined(USE_AURA) - const std::string& ToString() const { return data_; } #endif private: @@ -116,13 +116,13 @@ class UI_BASE_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) { FormatType(UINT native_format, LONG index); UINT ToUINT() const { return data_.cfFormat; } FORMATETC data_; +#elif defined(USE_AURA) + explicit FormatType(const std::string& native_format); + std::string data_; #elif defined(OS_MACOSX) explicit FormatType(NSString* native_format); NSString* ToNSString() const { return data_; } NSString* data_; -#elif defined(USE_AURA) - explicit FormatType(const std::string& native_format); - std::string data_; #elif defined(TOOLKIT_GTK) explicit FormatType(const std::string& native_format); explicit FormatType(const GdkAtom& native_format); diff --git a/ui/base/clipboard/clipboard_aura.cc b/ui/base/clipboard/clipboard_aura.cc index ab4cf3e..b8336b1a 100644 --- a/ui/base/clipboard/clipboard_aura.cc +++ b/ui/base/clipboard/clipboard_aura.cc @@ -47,7 +47,7 @@ class ClipboardData { virtual ~ClipboardData() {} // Bitmask of AuraClipboardFormat types. - const int format() const { return format_; } + int format() const { return format_; } const std::string& text() const { return text_; } void set_text(const std::string& text) { diff --git a/ui/base/clipboard/custom_data_helper.h b/ui/base/clipboard/custom_data_helper.h index 9ca7065..47e7f6a 100644 --- a/ui/base/clipboard/custom_data_helper.h +++ b/ui/base/clipboard/custom_data_helper.h @@ -28,7 +28,7 @@ class NSString; namespace ui { -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(USE_AURA) UI_BASE_EXPORT extern NSString* const kWebCustomDataPboardType; #elif (!defined(OS_WIN) && defined(USE_AURA)) || defined(TOOLKIT_GTK) UI_BASE_EXPORT extern const char kMimeTypeWebCustomData[]; diff --git a/ui/base/clipboard/custom_data_helper_mac.mm b/ui/base/clipboard/custom_data_helper_mac.mm index 5447ae3..ae43621 100644 --- a/ui/base/clipboard/custom_data_helper_mac.mm +++ b/ui/base/clipboard/custom_data_helper_mac.mm @@ -9,6 +9,10 @@ namespace ui { // TODO(dcheng): This name is temporary. See crbug.com/106449. +#if defined(USE_AURA) +const char kMimeTypeWebCustomData[] = "chromium/x-web-custom-data"; +#else NSString* const kWebCustomDataPboardType = @"org.chromium.web-custom-data"; +#endif } // namespace ui diff --git a/ui/base/cursor/cursor_mac.mm b/ui/base/cursor/cursor_mac.mm new file mode 100644 index 0000000..277717d --- /dev/null +++ b/ui/base/cursor/cursor_mac.mm @@ -0,0 +1,17 @@ +// Copyright 2014 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/base/cursor/cursor.h" + +namespace ui { + +void Cursor::RefCustomCursor() { + // TODO(macguru): +} + +void Cursor::UnrefCustomCursor() { + // TODO(macguru): +} + +} // namespace ui diff --git a/ui/base/view_prop.h b/ui/base/view_prop.h index 789cd46e..3ce14ba 100644 --- a/ui/base/view_prop.h +++ b/ui/base/view_prop.h @@ -10,7 +10,7 @@ #include "ui/base/ui_base_export.h" #include "ui/gfx/native_widget_types.h" -#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(USE_AURA)) +#if !defined(OS_WIN) && !defined(USE_AURA) #error view_prop.h is only for windows and aura builds. #endif diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm index 51c0b66..377c859 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm @@ -154,7 +154,10 @@ class ScreenMac : public gfx::Screen { virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE { - NSWindow* window = [view window]; + NSWindow* window = nil; +#if !defined(USE_AURA) + window = [view window]; +#endif if (!window) return GetPrimaryDisplay(); NSScreen* match_screen = [window screen]; @@ -209,8 +212,10 @@ class ScreenMac : public gfx::Screen { namespace gfx { +#if !defined(USE_AURA) Screen* CreateNativeScreen() { return new ScreenMac; } +#endif } diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd index 8fd038e..f6c77e6 100644 --- a/ui/resources/ui_resources.grd +++ b/ui/resources/ui_resources.grd @@ -306,7 +306,7 @@ <structure type="chrome_scaled_image" name="IDR_MENU_HIERARCHY_ARROW" file="common/menu_hierarchy_arrow.png" /> <structure type="chrome_scaled_image" name="IDR_MENU_HIERARCHY_ARROW_DARK_BACKGROUND" file="common/menu_hierarchy_arrow_white.png" /> </if> - <if expr="is_macosx or is_ios"> + <if expr="(is_macosx or is_ios) and not pp_ifdef('toolkit_views')"> <structure type="chrome_scaled_image" name="IDR_MENU_HIERARCHY_ARROW" file="mac/menu_hierarchy_arrow.png" /> </if> <if expr="pp_ifdef('toolkit_views')"> @@ -133,6 +133,7 @@ 'base/cursor/cursor_loader_x11.cc', 'base/cursor/cursor_loader_x11.h', 'base/cursor/cursor_null.cc', + 'base/cursor/cursor_mac.mm', 'base/cursor/cursor_win.cc', 'base/cursor/cursor_x11.cc', 'base/cursor/cursors_aura.cc', @@ -356,6 +357,8 @@ }], ['use_aura==1', { 'sources/': [ + ['exclude', 'base/clipboard/clipboard_mac.mm'], + ['exclude', 'base/layout_mac.mm'], ['exclude', 'base/work_area_watcher_observer.h'], ['exclude', 'base/x/active_window_watcher_x.cc'], ['exclude', 'base/x/active_window_watcher_x.h'], @@ -374,6 +377,7 @@ 'base/cursor/cursor.h', 'base/cursor/cursor_loader_x11.cc', 'base/cursor/cursor_loader_x11.h', + 'base/cursor/cursor_mac.mm', 'base/cursor/cursor_win.cc', 'base/cursor/cursor_x11.cc', 'base/x/selection_owner.cc', diff --git a/ui/ui_unittests.gyp b/ui/ui_unittests.gyp index 0d3d292..589ecda 100644 --- a/ui/ui_unittests.gyp +++ b/ui/ui_unittests.gyp @@ -54,6 +54,7 @@ }], ['use_aura==1', { 'sources!': [ + 'base/test/ui_controls_mac.mm', 'base/test/ui_controls_win.cc', ], }], |