| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 15 #include "ui/app_list/test/app_list_test_model.h" | 16 #include "ui/app_list/test/app_list_test_model.h" |
| 16 #include "ui/app_list/test/app_list_test_view_delegate.h" | 17 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| 17 #include "ui/app_list/views/app_list_view.h" | 18 #include "ui/app_list/views/app_list_view.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/resources/grit/ui_resources.h" | 20 #include "ui/resources/grit/ui_resources.h" |
| 20 #include "ui/views/controls/webview/webview.h" | 21 #include "ui/views/controls/webview/webview.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 43 app_list::AppListView* InitView(gfx::NativeWindow window_context); | 44 app_list::AppListView* InitView(gfx::NativeWindow window_context); |
| 44 | 45 |
| 45 // Overridden from AppListViewDelegate: | 46 // Overridden from AppListViewDelegate: |
| 46 void Dismiss() override; | 47 void Dismiss() override; |
| 47 void ViewClosing() override; | 48 void ViewClosing() override; |
| 48 views::View* CreateStartPageWebView(const gfx::Size& size) override; | 49 views::View* CreateStartPageWebView(const gfx::Size& size) override; |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 app_list::AppListView* view_; // Weak. Owns this. | 52 app_list::AppListView* view_; // Weak. Owns this. |
| 52 content::BrowserContext* browser_context_; | 53 content::BrowserContext* browser_context_; |
| 53 scoped_ptr<content::WebContents> web_contents_; | 54 std::unique_ptr<content::WebContents> web_contents_; |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(DemoAppListViewDelegate); | 56 DISALLOW_COPY_AND_ASSIGN(DemoAppListViewDelegate); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 app_list::AppListView* DemoAppListViewDelegate::InitView( | 59 app_list::AppListView* DemoAppListViewDelegate::InitView( |
| 59 gfx::NativeWindow window_context) { | 60 gfx::NativeWindow window_context) { |
| 60 gfx::NativeView container = NULL; | 61 gfx::NativeView container = NULL; |
| 61 // On Ash, the app list is placed into an aura::Window container. For the demo | 62 // On Ash, the app list is placed into an aura::Window container. For the demo |
| 62 // use the root window context as the parent. This only works on Aura since an | 63 // use the root window context as the parent. This only works on Aura since an |
| 63 // aura::Window is also a NativeView. | 64 // aura::Window is also a NativeView. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 content::InitializeSandboxInfo(&sandbox_info); | 128 content::InitializeSandboxInfo(&sandbox_info); |
| 128 ui::ViewsContentClient views_content_client(instance, &sandbox_info); | 129 ui::ViewsContentClient views_content_client(instance, &sandbox_info); |
| 129 #else | 130 #else |
| 130 int main(int argc, const char** argv) { | 131 int main(int argc, const char** argv) { |
| 131 ui::ViewsContentClient views_content_client(argc, argv); | 132 ui::ViewsContentClient views_content_client(argc, argv); |
| 132 #endif | 133 #endif |
| 133 | 134 |
| 134 views_content_client.set_task(base::Bind(&ShowAppList)); | 135 views_content_client.set_task(base::Bind(&ShowAppList)); |
| 135 return views_content_client.RunMain(); | 136 return views_content_client.RunMain(); |
| 136 } | 137 } |
| OLD | NEW |