Index: ui/app_list/views/views_demo_app_aura.cc |
diff --git a/ui/app_list/views/views_demo_app_aura.cc b/ui/app_list/views/views_demo_app_aura.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4dd85b1a804e39ee6a891c105a00491a4dca4dda |
--- /dev/null |
+++ b/ui/app_list/views/views_demo_app_aura.cc |
@@ -0,0 +1,98 @@ |
+// 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/app_list/views/views_demo_app.h" |
+ |
+#include "ui/aura/env.h" |
+#include "ui/aura/window.h" |
+#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
+#include "ui/views/widget/desktop_aura/desktop_screen.h" |
+#include "ui/wm/core/wm_state.h" |
+ |
+namespace { |
+ |
+// ViewsDelegate implementation to mimic ChromeViewsDelegate, without Chrome. |
+class DemoViewsDelegate : public views::ViewsDelegate { |
+ public: |
+ DemoViewsDelegate() {} |
+ virtual ~DemoViewsDelegate() {} |
+ |
+ protected: |
+ // Overridden from views::ViewsDelegate: |
+ virtual void SaveWindowPlacement(const views::Widget* window, |
+ const std::string& window_name, |
+ const gfx::Rect& bounds, |
+ ui::WindowShowState show_state) OVERRIDE {} |
+ virtual bool GetSavedWindowPlacement( |
+ const views::Widget* widget, |
+ const std::string& window_name, |
+ gfx::Rect* bounds, |
+ ui::WindowShowState* show_state) const OVERRIDE { |
+ return false; |
+ } |
+ virtual void NotifyAccessibilityEvent(views::View* view, |
+ ui::AXEvent event_type) OVERRIDE {} |
+ virtual void NotifyMenuItemFocused(const base::string16& menu_name, |
+ const base::string16& menu_item_name, |
+ int item_index, |
+ int item_count, |
+ bool has_submenu) OVERRIDE {} |
+ |
+ virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( |
+ views::Widget* widget) OVERRIDE { |
+ return NULL; |
+ } |
+ virtual void AddRef() OVERRIDE {} |
+ virtual void ReleaseRef() OVERRIDE {} |
+ virtual content::WebContents* CreateWebContents( |
+ content::BrowserContext* browser_context, |
+ content::SiteInstance* site_instance) OVERRIDE { |
+ return NULL; |
+ } |
+ virtual void OnBeforeWidgetInit( |
+ views::Widget::InitParams* params, |
+ views::internal::NativeWidgetDelegate* delegate) OVERRIDE { |
+ if (params->parent == NULL && params->context == NULL && params->top_level) |
+ params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
+ } |
+ virtual base::TimeDelta GetDefaultTextfieldObscuredRevealDuration() OVERRIDE { |
+ return base::TimeDelta(); |
+ } |
+ virtual bool WindowManagerProvidesTitleBar(bool maximized) OVERRIDE { |
+ return true; |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DemoViewsDelegate); |
+}; |
+ |
+class ViewsDemoAppAura : public ViewsDemoApp { |
+ public: |
+ ViewsDemoAppAura(scoped_ptr<ViewsDemoAppDelegate> delegate) |
+ delegate_(delegate) { |
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, |
+ views::CreateDesktopScreen()); |
+ views::ViewsDelegate::views_delegate = new DemoViewsDelegate; |
+ aura::Env::CreateInstance(); |
+ } |
+ |
+ virtual void Run() OVERRIDE { |
+ base::MessageLoopForUI message_loop; |
+ delegate_->Run(); |
+ } |
+ |
+ private: |
+ wm::WMState wm_state; |
+ base::scoped_nsobject<CocoaDemoAppImpl> impl_; |
+ scoped_ptr<ViewsDemoAppDelegate> delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ViewsDemoAppAura); |
+}; |
+} |
+ |
+// static |
+scoped_ptr<ViewsDemoApp> ViewsDemoApp::Create( |
+ scoped_ptr<ViewsDemoAppDelegate> delegate) { |
+ return scoped_ptr<ViewsDemoApp>(new ViewsDemoAppAura(delegate.Pass())); |
+} |