Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/engine/browser/blimp_engine_session.h" | 5 #include "blimp/engine/browser/blimp_engine_session.h" |
| 6 | 6 |
| 7 #include "blimp/common/proto/blimp_message.pb.h" | 7 #include "blimp/common/proto/blimp_message.pb.h" |
| 8 #include "blimp/common/proto/control.pb.h" | 8 #include "blimp/common/proto/control.pb.h" |
| 9 #include "blimp/engine/browser/blimp_browser_context.h" | 9 #include "blimp/engine/browser/blimp_browser_context.h" |
| 10 #include "blimp/engine/ui/blimp_layout_manager.h" | 10 #include "blimp/engine/ui/blimp_layout_manager.h" |
| 11 #include "blimp/engine/ui/blimp_screen.h" | 11 #include "blimp/engine/ui/blimp_screen.h" |
| 12 #include "blimp/engine/ui/blimp_ui_context_factory.h" | 12 #include "blimp/engine/ui/blimp_ui_context_factory.h" |
| 13 #include "blimp/net/blimp_connection.h" | 13 #include "blimp/net/blimp_connection.h" |
| 14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 15 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
| 16 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/render_widget_host.h" | 18 #include "content/public/browser/render_widget_host.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/browser/web_contents_source.h" | |
| 20 #include "ui/aura/client/default_capture_client.h" | 21 #include "ui/aura/client/default_capture_client.h" |
| 21 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_tree_host.h" | 24 #include "ui/aura/window_tree_host.h" |
| 24 #include "ui/wm/core/base_focus_rules.h" | 25 #include "ui/wm/core/base_focus_rules.h" |
| 25 #include "ui/wm/core/default_activation_client.h" | 26 #include "ui/wm/core/default_activation_client.h" |
| 26 #include "ui/wm/core/focus_controller.h" | 27 #include "ui/wm/core/focus_controller.h" |
| 27 | 28 |
| 28 #if !defined(USE_X11) | 29 #if !defined(USE_X11) |
| 29 #include "blimp/engine/ui/blimp_window_tree_host.h" | 30 #include "blimp/engine/ui/blimp_window_tree_host.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 window_tree_host_->SetBounds(gfx::Rect(screen_->GetPrimaryDisplay().size())); | 87 window_tree_host_->SetBounds(gfx::Rect(screen_->GetPrimaryDisplay().size())); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void BlimpEngineSession::CreateWebContents(const int target_tab_id) { | 90 void BlimpEngineSession::CreateWebContents(const int target_tab_id) { |
| 90 // TODO(haibinlu): Support more than one active WebContents (crbug/547231). | 91 // TODO(haibinlu): Support more than one active WebContents (crbug/547231). |
| 91 DCHECK(!web_contents_); | 92 DCHECK(!web_contents_); |
| 92 content::WebContents::CreateParams create_params(browser_context_.get(), | 93 content::WebContents::CreateParams create_params(browser_context_.get(), |
| 93 nullptr); | 94 nullptr); |
| 94 scoped_ptr<content::WebContents> new_contents = | 95 scoped_ptr<content::WebContents> new_contents = |
| 95 make_scoped_ptr(content::WebContents::Create(create_params)); | 96 make_scoped_ptr(content::WebContents::Create(create_params)); |
| 97 WebContentsSource::CreateForWebContentsAndLocation(web_contents.get(), | |
|
Mike Wittman
2015/11/11 17:15:28
I don't think blimp is used on desktop, so this pr
hcarmona
2015/11/11 19:57:58
Done.
| |
| 98 FROM_HERE); | |
| 96 PlatformSetContents(new_contents.Pass()); | 99 PlatformSetContents(new_contents.Pass()); |
| 97 } | 100 } |
| 98 | 101 |
| 99 void BlimpEngineSession::LoadUrl(const int target_tab_id, const GURL& url) { | 102 void BlimpEngineSession::LoadUrl(const int target_tab_id, const GURL& url) { |
| 100 if (url.is_empty() || !web_contents_) | 103 if (url.is_empty() || !web_contents_) |
| 101 return; | 104 return; |
| 102 | 105 |
| 103 content::NavigationController::LoadURLParams params(url); | 106 content::NavigationController::LoadURLParams params(url); |
| 104 params.transition_type = ui::PageTransitionFromInt( | 107 params.transition_type = ui::PageTransitionFromInt( |
| 105 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 108 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 193 |
| 191 aura::Window* parent = window_tree_host_->window(); | 194 aura::Window* parent = window_tree_host_->window(); |
| 192 aura::Window* content = web_contents_->GetNativeView(); | 195 aura::Window* content = web_contents_->GetNativeView(); |
| 193 if (!parent->Contains(content)) | 196 if (!parent->Contains(content)) |
| 194 parent->AddChild(content); | 197 parent->AddChild(content); |
| 195 content->Show(); | 198 content->Show(); |
| 196 } | 199 } |
| 197 | 200 |
| 198 } // namespace engine | 201 } // namespace engine |
| 199 } // namespace blimp | 202 } // namespace blimp |
| OLD | NEW |