| 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<char>& proto) { |
| 239 // TODO(dtrainor): Send the compositor proto. |
| 240 } |
| 241 |
| 236 void BlimpEngineSession::PlatformSetContents( | 242 void BlimpEngineSession::PlatformSetContents( |
| 237 scoped_ptr<content::WebContents> new_contents) { | 243 scoped_ptr<content::WebContents> new_contents) { |
| 238 new_contents->SetDelegate(this); | 244 new_contents->SetDelegate(this); |
| 239 web_contents_ = new_contents.Pass(); | 245 web_contents_ = new_contents.Pass(); |
| 240 | 246 |
| 241 aura::Window* parent = window_tree_host_->window(); | 247 aura::Window* parent = window_tree_host_->window(); |
| 242 aura::Window* content = web_contents_->GetNativeView(); | 248 aura::Window* content = web_contents_->GetNativeView(); |
| 243 if (!parent->Contains(content)) | 249 if (!parent->Contains(content)) |
| 244 parent->AddChild(content); | 250 parent->AddChild(content); |
| 245 content->Show(); | 251 content->Show(); |
| 246 } | 252 } |
| 247 | 253 |
| 248 } // namespace engine | 254 } // namespace engine |
| 249 } // namespace blimp | 255 } // namespace blimp |
| OLD | NEW |