| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell.h" | 5 #include "content/shell/browser/shell.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "content/public/browser/context_factory.h" | 13 #include "content/public/browser/context_factory.h" |
| 14 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/common/context_menu_params.h" | 16 #include "content/public/common/context_menu_params.h" |
| 17 #include "content/shell/browser/shell_platform_data_aura.h" | 17 #include "content/shell/browser/shell_platform_data_aura.h" |
| 18 #include "ui/aura/client/screen_position_client.h" | 18 #include "ui/aura/client/screen_position_client.h" |
| 19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 22 #include "ui/base/clipboard/clipboard.h" | 22 #include "ui/base/clipboard/clipboard.h" |
| 23 #include "ui/base/models/simple_menu_model.h" | 23 #include "ui/base/models/simple_menu_model.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/display/screen.h" |
| 25 #include "ui/events/event.h" | 26 #include "ui/events/event.h" |
| 26 #include "ui/gfx/screen.h" | |
| 27 #include "ui/views/background.h" | 27 #include "ui/views/background.h" |
| 28 #include "ui/views/controls/button/label_button.h" | 28 #include "ui/views/controls/button/label_button.h" |
| 29 #include "ui/views/controls/button/menu_button.h" | 29 #include "ui/views/controls/button/menu_button.h" |
| 30 #include "ui/views/controls/button/menu_button_listener.h" | 30 #include "ui/views/controls/button/menu_button_listener.h" |
| 31 #include "ui/views/controls/menu/menu_runner.h" | 31 #include "ui/views/controls/menu/menu_runner.h" |
| 32 #include "ui/views/controls/textfield/textfield.h" | 32 #include "ui/views/controls/textfield/textfield.h" |
| 33 #include "ui/views/controls/textfield/textfield_controller.h" | 33 #include "ui/views/controls/textfield/textfield_controller.h" |
| 34 #include "ui/views/controls/webview/webview.h" | 34 #include "ui/views/controls/webview/webview.h" |
| 35 #include "ui/views/layout/fill_layout.h" | 35 #include "ui/views/layout/fill_layout.h" |
| 36 #include "ui/views/layout/grid_layout.h" | 36 #include "ui/views/layout/grid_layout.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 View* contents_view_; | 378 View* contents_view_; |
| 379 views::WebView* web_view_; | 379 views::WebView* web_view_; |
| 380 | 380 |
| 381 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView); | 381 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView); |
| 382 }; | 382 }; |
| 383 | 383 |
| 384 } // namespace | 384 } // namespace |
| 385 | 385 |
| 386 #if defined(OS_CHROMEOS) | 386 #if defined(OS_CHROMEOS) |
| 387 wm::WMTestHelper* Shell::wm_test_helper_ = NULL; | 387 wm::WMTestHelper* Shell::wm_test_helper_ = NULL; |
| 388 gfx::Screen* Shell::test_screen_ = NULL; | 388 display::Screen* Shell::test_screen_ = NULL; |
| 389 #endif | 389 #endif |
| 390 views::ViewsDelegate* Shell::views_delegate_ = NULL; | 390 views::ViewsDelegate* Shell::views_delegate_ = NULL; |
| 391 | 391 |
| 392 // static | 392 // static |
| 393 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { | 393 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { |
| 394 #if defined(OS_WIN) | 394 #if defined(OS_WIN) |
| 395 _setmode(_fileno(stdout), _O_BINARY); | 395 _setmode(_fileno(stdout), _O_BINARY); |
| 396 _setmode(_fileno(stderr), _O_BINARY); | 396 _setmode(_fileno(stderr), _O_BINARY); |
| 397 #endif | 397 #endif |
| 398 #if defined(OS_CHROMEOS) | 398 #if defined(OS_CHROMEOS) |
| 399 test_screen_ = aura::TestScreen::Create(gfx::Size()); | 399 test_screen_ = aura::TestScreen::Create(gfx::Size()); |
| 400 gfx::Screen::SetScreenInstance(test_screen_); | 400 display::Screen::SetScreenInstance(test_screen_); |
| 401 wm_test_helper_ = new wm::WMTestHelper(default_window_size, | 401 wm_test_helper_ = new wm::WMTestHelper(default_window_size, |
| 402 GetContextFactory()); | 402 GetContextFactory()); |
| 403 #else | 403 #else |
| 404 gfx::Screen::SetScreenInstance(views::CreateDesktopScreen()); | 404 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); |
| 405 #endif | 405 #endif |
| 406 views_delegate_ = new views::DesktopTestViewsDelegate(); | 406 views_delegate_ = new views::DesktopTestViewsDelegate(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void Shell::PlatformExit() { | 409 void Shell::PlatformExit() { |
| 410 #if defined(OS_CHROMEOS) | 410 #if defined(OS_CHROMEOS) |
| 411 delete wm_test_helper_; | 411 delete wm_test_helper_; |
| 412 wm_test_helper_ = NULL; | 412 wm_test_helper_ = NULL; |
| 413 | 413 |
| 414 delete test_screen_; | 414 delete test_screen_; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 const content::ContextMenuParams& params) { | 528 const content::ContextMenuParams& params) { |
| 529 if (headless_) | 529 if (headless_) |
| 530 return true; | 530 return true; |
| 531 ShellWindowDelegateView* delegate_view = | 531 ShellWindowDelegateView* delegate_view = |
| 532 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 532 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 533 delegate_view->ShowWebViewContextMenu(params); | 533 delegate_view->ShowWebViewContextMenu(params); |
| 534 return true; | 534 return true; |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace content | 537 } // namespace content |
| OLD | NEW |