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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/public/browser/context_factory.h" |
9 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
11 #include "content/public/common/context_menu_params.h" | 12 #include "content/public/common/context_menu_params.h" |
12 #include "content/shell/browser/shell_platform_data_aura.h" | 13 #include "content/shell/browser/shell_platform_data_aura.h" |
13 #include "ui/aura/client/screen_position_client.h" | 14 #include "ui/aura/client/screen_position_client.h" |
14 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
16 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
17 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
18 #include "ui/base/models/simple_menu_model.h" | 19 #include "ui/base/models/simple_menu_model.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // static | 418 // static |
418 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { | 419 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { |
419 #if defined(OS_WIN) | 420 #if defined(OS_WIN) |
420 _setmode(_fileno(stdout), _O_BINARY); | 421 _setmode(_fileno(stdout), _O_BINARY); |
421 _setmode(_fileno(stderr), _O_BINARY); | 422 _setmode(_fileno(stderr), _O_BINARY); |
422 #endif | 423 #endif |
423 #if defined(OS_CHROMEOS) | 424 #if defined(OS_CHROMEOS) |
424 chromeos::DBusThreadManager::Initialize(); | 425 chromeos::DBusThreadManager::Initialize(); |
425 gfx::Screen::SetScreenInstance( | 426 gfx::Screen::SetScreenInstance( |
426 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); | 427 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); |
427 wm_test_helper_ = new wm::WMTestHelper(default_window_size); | 428 wm_test_helper_ = new wm::WMTestHelper(default_window_size, |
| 429 GetContextFactory()); |
428 #else | 430 #else |
429 gfx::Screen::SetScreenInstance( | 431 gfx::Screen::SetScreenInstance( |
430 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); | 432 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); |
431 #endif | 433 #endif |
432 views_delegate_ = new ShellViewsDelegateAura(); | 434 ShellViewsDelegateAura* views_delegate = new ShellViewsDelegateAura(); |
| 435 views_delegate_ = views_delegate; |
| 436 views_delegate->set_context_factory(GetContextFactory()); |
433 } | 437 } |
434 | 438 |
435 void Shell::PlatformExit() { | 439 void Shell::PlatformExit() { |
436 #if defined(OS_CHROMEOS) | 440 #if defined(OS_CHROMEOS) |
437 delete wm_test_helper_; | 441 delete wm_test_helper_; |
438 #endif | 442 #endif |
439 delete views_delegate_; | 443 delete views_delegate_; |
440 views_delegate_ = NULL; | 444 views_delegate_ = NULL; |
441 delete platform_; | 445 delete platform_; |
442 platform_ = NULL; | 446 platform_ = NULL; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 566 |
563 void Shell::PlatformWebContentsFocused(WebContents* contents) { | 567 void Shell::PlatformWebContentsFocused(WebContents* contents) { |
564 if (headless_) | 568 if (headless_) |
565 return; | 569 return; |
566 ShellWindowDelegateView* delegate_view = | 570 ShellWindowDelegateView* delegate_view = |
567 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 571 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
568 delegate_view->OnWebContentsFocused(contents); | 572 delegate_view->OnWebContentsFocused(contents); |
569 } | 573 } |
570 | 574 |
571 } // namespace content | 575 } // namespace content |
OLD | NEW |