| 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 "chromecast/browser/cast_content_window.h" | 5 #include "chromecast/browser/cast_content_window.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "chromecast/base/chromecast_switches.h" | 9 #include "chromecast/base/chromecast_switches.h" |
| 10 #include "chromecast/base/metrics/cast_metrics_helper.h" | 10 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 11 #include "chromecast/browser/cast_browser_process.h" | 11 #include "chromecast/browser/cast_browser_process.h" |
| 12 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
| 16 | 16 |
| 17 #if defined(USE_AURA) | 17 #if defined(USE_AURA) |
| 18 #include "chromecast/graphics/cast_screen.h" | 18 #include "chromecast/graphics/cast_screen.h" |
| 19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 20 #include "ui/aura/layout_manager.h" | 20 #include "ui/aura/layout_manager.h" |
| 21 #include "ui/aura/test/test_focus_client.h" | |
| 22 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_tree_host.h" | 22 #include "ui/aura/window_tree_host.h" |
| 24 #endif | 23 #endif |
| 25 | 24 |
| 26 namespace chromecast { | 25 namespace chromecast { |
| 27 | 26 |
| 28 #if defined(USE_AURA) | 27 #if defined(USE_AURA) |
| 29 class CastFillLayout : public aura::LayoutManager { | 28 class CastFillLayout : public aura::LayoutManager { |
| 30 public: | 29 public: |
| 31 explicit CastFillLayout(aura::Window* root) : root_(root) {} | 30 explicit CastFillLayout(aura::Window* root) : root_(root) {} |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 window_tree_host_->window()->SetLayoutManager( | 84 window_tree_host_->window()->SetLayoutManager( |
| 86 new CastFillLayout(window_tree_host_->window())); | 85 new CastFillLayout(window_tree_host_->window())); |
| 87 | 86 |
| 88 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); | 87 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
| 89 if (command_line->HasSwitch(switches::kEnableTransparentBackground)) { | 88 if (command_line->HasSwitch(switches::kEnableTransparentBackground)) { |
| 90 window_tree_host_->compositor()->SetBackgroundColor(SK_ColorTRANSPARENT); | 89 window_tree_host_->compositor()->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 91 window_tree_host_->compositor()->SetHostHasTransparentBackground(true); | 90 window_tree_host_->compositor()->SetHostHasTransparentBackground(true); |
| 92 } else { | 91 } else { |
| 93 window_tree_host_->compositor()->SetBackgroundColor(SK_ColorBLACK); | 92 window_tree_host_->compositor()->SetBackgroundColor(SK_ColorBLACK); |
| 94 } | 93 } |
| 95 | |
| 96 focus_client_.reset(new aura::test::TestFocusClient()); | |
| 97 aura::client::SetFocusClient( | |
| 98 window_tree_host_->window(), focus_client_.get()); | |
| 99 | |
| 100 window_tree_host_->Show(); | 94 window_tree_host_->Show(); |
| 101 | 95 |
| 102 // Add and show content's view/window | 96 // Add and show content's view/window |
| 103 aura::Window* content_window = web_contents->GetNativeView(); | 97 aura::Window* content_window = web_contents->GetNativeView(); |
| 104 aura::Window* parent = window_tree_host_->window(); | 98 aura::Window* parent = window_tree_host_->window(); |
| 105 if (!parent->Contains(content_window)) { | 99 if (!parent->Contains(content_window)) { |
| 106 parent->AddChild(content_window); | 100 parent->AddChild(content_window); |
| 107 } | 101 } |
| 108 content_window->Show(); | 102 content_window->Show(); |
| 109 #endif | 103 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 137 content::RenderViewHost* render_view_host) { | 131 content::RenderViewHost* render_view_host) { |
| 138 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); | 132 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
| 139 if (command_line->HasSwitch(switches::kEnableTransparentBackground)) { | 133 if (command_line->HasSwitch(switches::kEnableTransparentBackground)) { |
| 140 content::RenderWidgetHostView* view = render_view_host->GetView(); | 134 content::RenderWidgetHostView* view = render_view_host->GetView(); |
| 141 if (view) | 135 if (view) |
| 142 view->SetBackgroundColor(SK_ColorTRANSPARENT); | 136 view->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 143 } | 137 } |
| 144 } | 138 } |
| 145 | 139 |
| 146 } // namespace chromecast | 140 } // namespace chromecast |
| OLD | NEW |