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" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (!web_contents_) | 131 if (!web_contents_) |
132 return; | 132 return; |
133 | 133 |
134 web_contents_->GetController().Reload(true); | 134 web_contents_->GetController().Reload(true); |
135 } | 135 } |
136 | 136 |
137 void BlimpEngineSession::ProcessMessage( | 137 void BlimpEngineSession::ProcessMessage( |
138 scoped_ptr<BlimpMessage> message, | 138 scoped_ptr<BlimpMessage> message, |
139 const net::CompletionCallback& callback) { | 139 const net::CompletionCallback& callback) { |
140 DCHECK(message->type() == BlimpMessage::CONTROL || | 140 DCHECK(message->type() == BlimpMessage::CONTROL || |
141 message->type() == BlimpMessage::NAVIGATION); | 141 message->type() == BlimpMessage::NAVIGATION || |
| 142 message->type() == BlimpMessage::COMPOSITOR); |
142 | 143 |
143 if (message->type() == BlimpMessage::CONTROL) { | 144 if (message->type() == BlimpMessage::CONTROL) { |
144 switch (message->control().type()) { | 145 switch (message->control().type()) { |
145 case ControlMessage::CREATE_TAB: | 146 case ControlMessage::CREATE_TAB: |
146 CreateWebContents(message->target_tab_id()); | 147 CreateWebContents(message->target_tab_id()); |
147 break; | 148 break; |
148 case ControlMessage::CLOSE_TAB: | 149 case ControlMessage::CLOSE_TAB: |
149 CloseWebContents(message->target_tab_id()); | 150 CloseWebContents(message->target_tab_id()); |
150 default: | 151 default: |
151 NOTIMPLEMENTED(); | 152 NOTIMPLEMENTED(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 227 |
227 void BlimpEngineSession::CloseContents(content::WebContents* source) { | 228 void BlimpEngineSession::CloseContents(content::WebContents* source) { |
228 if (source == web_contents_) | 229 if (source == web_contents_) |
229 web_contents_.reset(); | 230 web_contents_.reset(); |
230 } | 231 } |
231 | 232 |
232 void BlimpEngineSession::ActivateContents(content::WebContents* contents) { | 233 void BlimpEngineSession::ActivateContents(content::WebContents* contents) { |
233 contents->GetRenderViewHost()->GetWidget()->Focus(); | 234 contents->GetRenderViewHost()->GetWidget()->Focus(); |
234 } | 235 } |
235 | 236 |
| 237 void BlimpEngineSession::ForwardCompositorProto( |
| 238 const std::vector<uint8_t>& proto) { |
| 239 // Send the compositor proto over the network layer to the client, which will |
| 240 // apply the proto to their local compositor instance. |
| 241 // TODO(dtrainor): Send the compositor proto. |
| 242 } |
| 243 |
236 void BlimpEngineSession::PlatformSetContents( | 244 void BlimpEngineSession::PlatformSetContents( |
237 scoped_ptr<content::WebContents> new_contents) { | 245 scoped_ptr<content::WebContents> new_contents) { |
238 new_contents->SetDelegate(this); | 246 new_contents->SetDelegate(this); |
239 web_contents_ = new_contents.Pass(); | 247 web_contents_ = new_contents.Pass(); |
240 | 248 |
241 aura::Window* parent = window_tree_host_->window(); | 249 aura::Window* parent = window_tree_host_->window(); |
242 aura::Window* content = web_contents_->GetNativeView(); | 250 aura::Window* content = web_contents_->GetNativeView(); |
243 if (!parent->Contains(content)) | 251 if (!parent->Contains(content)) |
244 parent->AddChild(content); | 252 parent->AddChild(content); |
245 content->Show(); | 253 content->Show(); |
246 } | 254 } |
247 | 255 |
248 } // namespace engine | 256 } // namespace engine |
249 } // namespace blimp | 257 } // namespace blimp |
OLD | NEW |