Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: blimp/engine/browser/blimp_engine_session.cc

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address wez's feedback. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "net/base/net_errors.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (url.is_empty() || !web_contents_) 101 if (url.is_empty() || !web_contents_)
101 return; 102 return;
102 103
103 content::NavigationController::LoadURLParams params(url); 104 content::NavigationController::LoadURLParams params(url);
104 params.transition_type = ui::PageTransitionFromInt( 105 params.transition_type = ui::PageTransitionFromInt(
105 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); 106 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
106 web_contents_->GetController().LoadURLWithParams(params); 107 web_contents_->GetController().LoadURLWithParams(params);
107 web_contents_->Focus(); 108 web_contents_->Focus();
108 } 109 }
109 110
110 net::Error BlimpEngineSession::OnBlimpMessage(const BlimpMessage& message) { 111 void BlimpEngineSession::ProcessMessage(
112 const BlimpMessage& message,
113 const net::CompletionCallback& callback) {
111 DCHECK(message.type() == BlimpMessage::CONTROL); 114 DCHECK(message.type() == BlimpMessage::CONTROL);
112 115
113 switch (message.control().type()) { 116 switch (message.control().type()) {
114 case ControlMessage::CREATE_TAB: 117 case ControlMessage::CREATE_TAB:
115 CreateWebContents(message.target_tab_id()); 118 CreateWebContents(message.target_tab_id());
116 break; 119 break;
117 case ControlMessage::LOAD_URL: 120 case ControlMessage::LOAD_URL:
118 LoadUrl(message.target_tab_id(), 121 LoadUrl(message.target_tab_id(),
119 GURL(message.control().load_url().url())); 122 GURL(message.control().load_url().url()));
120 break; 123 break;
121 default: 124 default:
122 NOTIMPLEMENTED(); 125 NOTIMPLEMENTED();
123 } 126 }
124 127
125 return net::OK; 128 callback.Run(net::OK);
Wez 2015/11/12 03:45:56 Didn't we agree that ProcessMessage should be requ
Kevin M 2015/11/12 19:03:47 Done.
126 } 129 }
127 130
128 void BlimpEngineSession::AddNewContents(content::WebContents* source, 131 void BlimpEngineSession::AddNewContents(content::WebContents* source,
129 content::WebContents* new_contents, 132 content::WebContents* new_contents,
130 WindowOpenDisposition disposition, 133 WindowOpenDisposition disposition,
131 const gfx::Rect& initial_rect, 134 const gfx::Rect& initial_rect,
132 bool user_gesture, 135 bool user_gesture,
133 bool* was_blocked) { 136 bool* was_blocked) {
134 NOTIMPLEMENTED(); 137 NOTIMPLEMENTED();
135 } 138 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698