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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 void BlimpEngineSession::Reload(const int target_tab_id) { | 129 void BlimpEngineSession::Reload(const int target_tab_id) { |
130 if (!web_contents_) | 130 if (!web_contents_) |
131 return; | 131 return; |
132 | 132 |
133 web_contents_->GetController().Reload(true); | 133 web_contents_->GetController().Reload(true); |
134 } | 134 } |
135 | 135 |
136 net::Error BlimpEngineSession::OnBlimpMessage(const BlimpMessage& message) { | 136 net::Error BlimpEngineSession::OnBlimpMessage(const BlimpMessage& message) { |
137 DCHECK(message.type() == BlimpMessage::CONTROL || | 137 DCHECK(message.type() == BlimpMessage::CONTROL || |
138 message.type() == BlimpMessage::NAVIGATION); | 138 message.type() == BlimpMessage::NAVIGATION || |
| 139 message.type() == BlimpMessage::COMPOSITOR); |
139 | 140 |
140 if (message.type() == BlimpMessage::CONTROL) { | 141 if (message.type() == BlimpMessage::CONTROL) { |
141 switch (message.control().type()) { | 142 switch (message.control().type()) { |
142 case ControlMessage::CREATE_TAB: | 143 case ControlMessage::CREATE_TAB: |
143 CreateWebContents(message.target_tab_id()); | 144 CreateWebContents(message.target_tab_id()); |
144 break; | 145 break; |
145 case ControlMessage::CLOSE_TAB: | 146 case ControlMessage::CLOSE_TAB: |
146 CloseWebContents(message.target_tab_id()); | 147 CloseWebContents(message.target_tab_id()); |
147 default: | 148 default: |
148 NOTIMPLEMENTED(); | 149 NOTIMPLEMENTED(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 222 |
222 void BlimpEngineSession::CloseContents(content::WebContents* source) { | 223 void BlimpEngineSession::CloseContents(content::WebContents* source) { |
223 if (source == web_contents_) | 224 if (source == web_contents_) |
224 web_contents_.reset(); | 225 web_contents_.reset(); |
225 } | 226 } |
226 | 227 |
227 void BlimpEngineSession::ActivateContents(content::WebContents* contents) { | 228 void BlimpEngineSession::ActivateContents(content::WebContents* contents) { |
228 contents->GetRenderViewHost()->GetWidget()->Focus(); | 229 contents->GetRenderViewHost()->GetWidget()->Focus(); |
229 } | 230 } |
230 | 231 |
| 232 void BlimpEngineSession::HandleCompositorProto(const std::vector<char>& proto) { |
| 233 // TODO(dtrainor): Send the compositor proto. |
| 234 } |
| 235 |
231 void BlimpEngineSession::PlatformSetContents( | 236 void BlimpEngineSession::PlatformSetContents( |
232 scoped_ptr<content::WebContents> new_contents) { | 237 scoped_ptr<content::WebContents> new_contents) { |
233 new_contents->SetDelegate(this); | 238 new_contents->SetDelegate(this); |
234 web_contents_ = new_contents.Pass(); | 239 web_contents_ = new_contents.Pass(); |
235 | 240 |
236 aura::Window* parent = window_tree_host_->window(); | 241 aura::Window* parent = window_tree_host_->window(); |
237 aura::Window* content = web_contents_->GetNativeView(); | 242 aura::Window* content = web_contents_->GetNativeView(); |
238 if (!parent->Contains(content)) | 243 if (!parent->Contains(content)) |
239 parent->AddChild(content); | 244 parent->AddChild(content); |
240 content->Show(); | 245 content->Show(); |
241 } | 246 } |
242 | 247 |
243 } // namespace engine | 248 } // namespace engine |
244 } // namespace blimp | 249 } // namespace blimp |
OLD | NEW |