summaryrefslogtreecommitdiffstats
path: root/blimp
diff options
context:
space:
mode:
Diffstat (limited to 'blimp')
-rw-r--r--blimp/client/compositor/blimp_compositor.cc6
-rw-r--r--blimp/client/session/tab_control_feature.cc1
-rw-r--r--blimp/client/session/tab_control_feature_unittest.cc1
-rw-r--r--blimp/common/create_blimp_message.cc1
-rw-r--r--blimp/common/create_blimp_message_unittest.cc1
-rw-r--r--blimp/common/proto/BUILD.gn1
-rw-r--r--blimp/common/proto/size.proto18
-rw-r--r--blimp/common/proto/tab_control.proto10
-rw-r--r--blimp/engine/browser/blimp_engine_session.cc37
-rw-r--r--blimp/engine/browser/blimp_engine_session.h4
10 files changed, 40 insertions, 40 deletions
diff --git a/blimp/client/compositor/blimp_compositor.cc b/blimp/client/compositor/blimp_compositor.cc
index cc3b557..107ac26 100644
--- a/blimp/client/compositor/blimp_compositor.cc
+++ b/blimp/client/compositor/blimp_compositor.cc
@@ -183,6 +183,8 @@ void BlimpCompositor::SendCompositorProto(
}
void BlimpCompositor::OnRenderWidgetInitialized() {
+ DVLOG(1) << "OnRenderWidgetInitialized";
+
// Tear down the output surface connection with the old LayerTreeHost
// instance.
SetVisible(false);
@@ -201,6 +203,10 @@ void BlimpCompositor::OnRenderWidgetInitialized() {
// Make sure we don't have a receiver at this point.
DCHECK(!remote_proto_channel_receiver_);
+
+ // TODO(khushalsagar): re-initialize compositor and input state for the new
+ // render widget.
+ SetVisible(true);
}
void BlimpCompositor::OnCompositorMessageReceived(
diff --git a/blimp/client/session/tab_control_feature.cc b/blimp/client/session/tab_control_feature.cc
index 5b1ccd9..e46cbd3 100644
--- a/blimp/client/session/tab_control_feature.cc
+++ b/blimp/client/session/tab_control_feature.cc
@@ -6,7 +6,6 @@
#include "blimp/common/create_blimp_message.h"
#include "blimp/common/proto/blimp_message.pb.h"
-#include "blimp/common/proto/size.pb.h"
#include "blimp/common/proto/tab_control.pb.h"
#include "blimp/net/blimp_message_processor.h"
diff --git a/blimp/client/session/tab_control_feature_unittest.cc b/blimp/client/session/tab_control_feature_unittest.cc
index 8c60e2cc..c93b2c6 100644
--- a/blimp/client/session/tab_control_feature_unittest.cc
+++ b/blimp/client/session/tab_control_feature_unittest.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "blimp/common/proto/blimp_message.pb.h"
-#include "blimp/common/proto/size.pb.h"
#include "blimp/common/proto/tab_control.pb.h"
#include "blimp/net/test_common.h"
#include "net/base/net_errors.h"
diff --git a/blimp/common/create_blimp_message.cc b/blimp/common/create_blimp_message.cc
index a765a82..09e6dea 100644
--- a/blimp/common/create_blimp_message.cc
+++ b/blimp/common/create_blimp_message.cc
@@ -10,7 +10,6 @@
#include "blimp/common/proto/compositor.pb.h"
#include "blimp/common/proto/input.pb.h"
#include "blimp/common/proto/render_widget.pb.h"
-#include "blimp/common/proto/size.pb.h"
#include "blimp/common/proto/tab_control.pb.h"
namespace blimp {
diff --git a/blimp/common/create_blimp_message_unittest.cc b/blimp/common/create_blimp_message_unittest.cc
index b33ce19..c99096f 100644
--- a/blimp/common/create_blimp_message_unittest.cc
+++ b/blimp/common/create_blimp_message_unittest.cc
@@ -8,7 +8,6 @@
#include "blimp/common/proto/input.pb.h"
#include "blimp/common/proto/navigation.pb.h"
#include "blimp/common/proto/render_widget.pb.h"
-#include "blimp/common/proto/size.pb.h"
#include "blimp/common/proto/tab_control.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/blimp/common/proto/BUILD.gn b/blimp/common/proto/BUILD.gn
index 3ed9400..d14960a 100644
--- a/blimp/common/proto/BUILD.gn
+++ b/blimp/common/proto/BUILD.gn
@@ -31,7 +31,6 @@ proto_library("proto_internal") {
"navigation.proto",
"protocol_control.proto",
"render_widget.proto",
- "size.proto",
"tab_control.proto",
]
diff --git a/blimp/common/proto/size.proto b/blimp/common/proto/size.proto
deleted file mode 100644
index fc59b2d..0000000
--- a/blimp/common/proto/size.proto
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-syntax = "proto2";
-
-option optimize_for = LITE_RUNTIME;
-
-package blimp;
-
-// Contains display information that represents resize events coming from the
-// client device.
-message SizeMessage {
- optional uint64 width = 1;
- optional uint64 height = 2;
- optional float device_pixel_ratio = 3;
-}
-
diff --git a/blimp/common/proto/tab_control.proto b/blimp/common/proto/tab_control.proto
index ead55f0..53d66ee 100644
--- a/blimp/common/proto/tab_control.proto
+++ b/blimp/common/proto/tab_control.proto
@@ -8,10 +8,16 @@ syntax = "proto2";
option optimize_for = LITE_RUNTIME;
-import "size.proto";
-
package blimp;
+// Contains display information that represents resize events coming from the
+// client device.
+message SizeMessage {
+ optional uint64 width = 1;
+ optional uint64 height = 2;
+ optional float device_pixel_ratio = 3;
+}
+
message TabControlMessage {
enum Type {
UNKNOWN = 0;
diff --git a/blimp/engine/browser/blimp_engine_session.cc b/blimp/engine/browser/blimp_engine_session.cc
index 69e9cf5..6e5f794 100644
--- a/blimp/engine/browser/blimp_engine_session.cc
+++ b/blimp/engine/browser/blimp_engine_session.cc
@@ -264,23 +264,31 @@ scoped_ptr<BlimpMessageProcessor> BlimpEngineSession::RegisterFeature(
return outgoing_proxy;
}
-void BlimpEngineSession::CreateWebContents(const int target_tab_id) {
+bool BlimpEngineSession::CreateWebContents(const int target_tab_id) {
+ DVLOG(1) << "Create tab " << target_tab_id;
// TODO(haibinlu): Support more than one active WebContents (crbug/547231).
- DCHECK(!web_contents_);
+ if (web_contents_) {
+ DLOG(WARNING) << "Tab " << target_tab_id << " already existed";
+ return false;
+ }
+
content::WebContents::CreateParams create_params(browser_context_.get(),
nullptr);
scoped_ptr<content::WebContents> new_contents =
make_scoped_ptr(content::WebContents::Create(create_params));
PlatformSetContents(std::move(new_contents));
+ return true;
}
void BlimpEngineSession::CloseWebContents(const int target_tab_id) {
+ DVLOG(1) << "Close tab " << target_tab_id;
DCHECK(web_contents_);
web_contents_->Close();
}
void BlimpEngineSession::HandleResize(float device_pixel_ratio,
const gfx::Size& size) {
+ DVLOG(1) << "Resize to " << size.ToString() << ", " << device_pixel_ratio;
screen_->UpdateDisplayScaleAndSize(device_pixel_ratio, size);
if (web_contents_ && web_contents_->GetRenderViewHost() &&
web_contents_->GetRenderViewHost()->GetWidget()) {
@@ -289,8 +297,10 @@ void BlimpEngineSession::HandleResize(float device_pixel_ratio,
}
void BlimpEngineSession::LoadUrl(const int target_tab_id, const GURL& url) {
- if (url.is_empty() || !web_contents_)
+ DVLOG(1) << "Load URL " << url << " in tab " << target_tab_id;
+ if (url.is_empty()) {
return;
+ }
// TODO(dtrainor, haibinlu): Fix up the URL with url_fixer.h. If that doesn't
// produce a valid spec() then try to build a search query?
@@ -302,23 +312,17 @@ void BlimpEngineSession::LoadUrl(const int target_tab_id, const GURL& url) {
}
void BlimpEngineSession::GoBack(const int target_tab_id) {
- if (!web_contents_)
- return;
-
+ DVLOG(1) << "Back in tab " << target_tab_id;
web_contents_->GetController().GoBack();
}
void BlimpEngineSession::GoForward(const int target_tab_id) {
- if (!web_contents_)
- return;
-
+ DVLOG(1) << "Forward in tab " << target_tab_id;
web_contents_->GetController().GoForward();
}
void BlimpEngineSession::Reload(const int target_tab_id) {
- if (!web_contents_)
- return;
-
+ DVLOG(1) << "Reload in tab " << target_tab_id;
web_contents_->GetController().Reload(true);
}
@@ -352,10 +356,11 @@ void BlimpEngineSession::ProcessMessage(
DCHECK(message->type() == BlimpMessage::TAB_CONTROL ||
message->type() == BlimpMessage::NAVIGATION);
+ bool result = true;
if (message->type() == BlimpMessage::TAB_CONTROL) {
switch (message->tab_control().type()) {
case TabControlMessage::CREATE_TAB:
- CreateWebContents(message->target_tab_id());
+ result = CreateWebContents(message->target_tab_id());
break;
case TabControlMessage::CLOSE_TAB:
CloseWebContents(message->target_tab_id());
@@ -385,10 +390,12 @@ void BlimpEngineSession::ProcessMessage(
default:
NOTIMPLEMENTED();
}
+ } else {
+ result = false;
}
if (!callback.is_null()) {
- callback.Run(net::OK);
+ callback.Run(result ? net::OK : net::ERR_FAILED);
}
}
@@ -491,6 +498,8 @@ void BlimpEngineSession::NavigationStateChanged(
void BlimpEngineSession::RenderViewHostChanged(
content::RenderViewHost* old_host,
content::RenderViewHost* new_host) {
+ // Informs client that WebContents swaps its visible RenderViewHost with
+ // another one.
render_widget_feature_.OnRenderWidgetInitialized(kDummyTabId);
}
diff --git a/blimp/engine/browser/blimp_engine_session.h b/blimp/engine/browser/blimp_engine_session.h
index 9c10f48..30fa9a1 100644
--- a/blimp/engine/browser/blimp_engine_session.h
+++ b/blimp/engine/browser/blimp_engine_session.h
@@ -95,7 +95,9 @@ class BlimpEngineSession
// TabControlMessage handler methods.
// Creates a new WebContents, which will be indexed by |target_tab_id|.
- void CreateWebContents(const int target_tab_id);
+ // Returns true if a new WebContents is created, false otherwise.
+ bool CreateWebContents(const int target_tab_id);
+
void CloseWebContents(const int target_tab_id);
void HandleResize(float device_pixel_ratio, const gfx::Size& size);