diff options
author | haibinlu <haibinlu@chromium.org> | 2015-12-17 13:29:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-17 21:30:53 +0000 |
commit | 81eee135b4be9f2e52b51cdfdb4e69e86cbcd112 (patch) | |
tree | cf1f5a917fa798bdccf1a8a8f0e2cef19291b8dc /blimp | |
parent | d9349170f5d10cb390c8bfe1a8af40d0eebd0991 (diff) | |
download | chromium_src-81eee135b4be9f2e52b51cdfdb4e69e86cbcd112.zip chromium_src-81eee135b4be9f2e52b51cdfdb4e69e86cbcd112.tar.gz chromium_src-81eee135b4be9f2e52b51cdfdb4e69e86cbcd112.tar.bz2 |
[Blimp] Rename CONTROL proto type to TAB_CONTROL.
Review URL: https://codereview.chromium.org/1530133006
Cr-Commit-Position: refs/heads/master@{#365889}
Diffstat (limited to 'blimp')
-rw-r--r-- | blimp/client/session/blimp_client_session.cc | 4 | ||||
-rw-r--r-- | blimp/client/session/tab_control_feature.cc | 2 | ||||
-rw-r--r-- | blimp/client/session/tab_control_feature.h | 4 | ||||
-rw-r--r-- | blimp/client/session/tab_control_feature_unittest.cc | 10 | ||||
-rw-r--r-- | blimp/common/create_blimp_message.cc | 13 | ||||
-rw-r--r-- | blimp/common/create_blimp_message.h | 4 | ||||
-rw-r--r-- | blimp/common/create_blimp_message_unittest.cc | 12 | ||||
-rw-r--r-- | blimp/common/proto/BUILD.gn | 2 | ||||
-rw-r--r-- | blimp/common/proto/blimp_message.proto | 6 | ||||
-rw-r--r-- | blimp/common/proto/tab_control.proto (renamed from blimp/common/proto/control.proto) | 6 | ||||
-rw-r--r-- | blimp/engine/browser/blimp_browser_main_parts.cc | 4 | ||||
-rw-r--r-- | blimp/engine/browser/blimp_engine_session.cc | 22 | ||||
-rw-r--r-- | blimp/engine/browser/blimp_engine_session.h | 2 | ||||
-rw-r--r-- | blimp/net/blimp_connection_unittest.cc | 2 | ||||
-rw-r--r-- | blimp/net/blimp_message_pump_unittest.cc | 2 |
15 files changed, 48 insertions, 47 deletions
diff --git a/blimp/client/session/blimp_client_session.cc b/blimp/client/session/blimp_client_session.cc index f0fcd39..b7973b2 100644 --- a/blimp/client/session/blimp_client_session.cc +++ b/blimp/client/session/blimp_client_session.cc @@ -18,8 +18,8 @@ BlimpClientSession::BlimpClientSession() render_widget_feature_(new RenderWidgetFeature) { // Connect the features with the network layer. tab_control_feature_->set_outgoing_message_processor( - connection_handler_->RegisterFeature(BlimpMessage::CONTROL, - tab_control_feature_.get())); + connection_handler_->RegisterFeature(BlimpMessage::TAB_CONTROL, + tab_control_feature_.get())); navigation_feature_->set_outgoing_message_processor( connection_handler_->RegisterFeature(BlimpMessage::NAVIGATION, navigation_feature_.get())); diff --git a/blimp/client/session/tab_control_feature.cc b/blimp/client/session/tab_control_feature.cc index 15cbdd1..3e15634 100644 --- a/blimp/client/session/tab_control_feature.cc +++ b/blimp/client/session/tab_control_feature.cc @@ -6,8 +6,8 @@ #include "blimp/common/create_blimp_message.h" #include "blimp/common/proto/blimp_message.pb.h" -#include "blimp/common/proto/control.pb.h" #include "blimp/common/proto/size.pb.h" +#include "blimp/common/proto/tab_control.pb.h" #include "blimp/net/blimp_message_processor.h" #include "ui/gfx/geometry/size.h" diff --git a/blimp/client/session/tab_control_feature.h b/blimp/client/session/tab_control_feature.h index 166dec7..840b7cd 100644 --- a/blimp/client/session/tab_control_feature.h +++ b/blimp/client/session/tab_control_feature.h @@ -22,7 +22,7 @@ class BLIMP_CLIENT_EXPORT TabControlFeature : public BlimpMessageProcessor { ~TabControlFeature() override; // Set the BlimpMessageProcessor that will be used to send - // BlimpMessage::CONTROL messages to the engine. + // BlimpMessage::TAB_CONTROL messages to the engine. void set_outgoing_message_processor( scoped_ptr<BlimpMessageProcessor> processor); @@ -35,7 +35,7 @@ class BLIMP_CLIENT_EXPORT TabControlFeature : public BlimpMessageProcessor { void ProcessMessage(scoped_ptr<BlimpMessage> message, const net::CompletionCallback& callback) override; - // Used to send BlimpMessage::CONTROL messages to the engine. + // Used to send BlimpMessage::TAB_CONTROL messages to the engine. scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_; DISALLOW_COPY_AND_ASSIGN(TabControlFeature); diff --git a/blimp/client/session/tab_control_feature_unittest.cc b/blimp/client/session/tab_control_feature_unittest.cc index d53bd97..c2969f5 100644 --- a/blimp/client/session/tab_control_feature_unittest.cc +++ b/blimp/client/session/tab_control_feature_unittest.cc @@ -7,8 +7,8 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "blimp/common/proto/blimp_message.pb.h" -#include "blimp/common/proto/control.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" #include "testing/gmock/include/gmock/gmock.h" @@ -20,10 +20,10 @@ using testing::_; namespace blimp { MATCHER_P3(EqualsSizeMessage, width, height, dp_to_px, "") { - return arg.control().type() == ControlMessage::SIZE && - arg.control().size().width() == width && - arg.control().size().height() == height && - arg.control().size().device_pixel_ratio() == dp_to_px; + return arg.tab_control().type() == TabControlMessage::SIZE && + arg.tab_control().size().width() == width && + arg.tab_control().size().height() == height && + arg.tab_control().size().device_pixel_ratio() == dp_to_px; } class TabControlFeatureTest : public testing::Test { diff --git a/blimp/common/create_blimp_message.cc b/blimp/common/create_blimp_message.cc index 13be17f..f656a73 100644 --- a/blimp/common/create_blimp_message.cc +++ b/blimp/common/create_blimp_message.cc @@ -8,10 +8,10 @@ #include "base/memory/scoped_ptr.h" #include "blimp/common/proto/blimp_message.pb.h" #include "blimp/common/proto/compositor.pb.h" -#include "blimp/common/proto/control.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 { @@ -26,11 +26,12 @@ scoped_ptr<BlimpMessage> CreateBlimpMessage( return output; } -scoped_ptr<BlimpMessage> CreateBlimpMessage(ControlMessage** control_message) { +scoped_ptr<BlimpMessage> CreateBlimpMessage( + TabControlMessage** control_message) { DCHECK(control_message); scoped_ptr<BlimpMessage> output(new BlimpMessage); - output->set_type(BlimpMessage::CONTROL); - *control_message = output->mutable_control(); + output->set_type(BlimpMessage::TAB_CONTROL); + *control_message = output->mutable_tab_control(); return output; } @@ -66,9 +67,9 @@ scoped_ptr<BlimpMessage> CreateBlimpMessage( scoped_ptr<BlimpMessage> CreateBlimpMessage(SizeMessage** size_message) { DCHECK(size_message); - ControlMessage* control_message; + TabControlMessage* control_message; scoped_ptr<BlimpMessage> output = CreateBlimpMessage(&control_message); - control_message->set_type(ControlMessage::SIZE); + control_message->set_type(TabControlMessage::SIZE); *size_message = control_message->mutable_size(); return output; } diff --git a/blimp/common/create_blimp_message.h b/blimp/common/create_blimp_message.h index 995e969..32dc445 100644 --- a/blimp/common/create_blimp_message.h +++ b/blimp/common/create_blimp_message.h @@ -14,7 +14,7 @@ namespace blimp { class BlimpMessage; class CompositorMessage; -class ControlMessage; +class TabControlMessage; class InputMessage; class NavigationMessage; class RenderWidgetMessage; @@ -38,7 +38,7 @@ BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage( int target_tab_id); BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage( - ControlMessage** control_message); + TabControlMessage** control_message); BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage( InputMessage** input_message); diff --git a/blimp/common/create_blimp_message_unittest.cc b/blimp/common/create_blimp_message_unittest.cc index 0c1760d..b33ce19 100644 --- a/blimp/common/create_blimp_message_unittest.cc +++ b/blimp/common/create_blimp_message_unittest.cc @@ -5,11 +5,11 @@ #include "blimp/common/create_blimp_message.h" #include "blimp/common/proto/blimp_message.pb.h" #include "blimp/common/proto/compositor.pb.h" -#include "blimp/common/proto/control.pb.h" #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" namespace blimp { @@ -26,12 +26,12 @@ TEST(CreateBlimpMessageTest, CompositorMessage) { EXPECT_EQ(kTabId, message->target_tab_id()); } -TEST(CreateBlimpMessageTest, ControlMessage) { - ControlMessage* details = nullptr; +TEST(CreateBlimpMessageTest, TabControlMessage) { + TabControlMessage* details = nullptr; scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details); EXPECT_NE(nullptr, details); EXPECT_NE(nullptr, message); - EXPECT_EQ(details, message->mutable_control()); + EXPECT_EQ(details, message->mutable_tab_control()); } TEST(CreateBlimpMessageTest, InputMessage) { @@ -65,8 +65,8 @@ TEST(CreateBlimpMessageTest, SizeMessage) { scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details); EXPECT_NE(nullptr, details); EXPECT_NE(nullptr, message); - EXPECT_EQ(ControlMessage::SIZE, message->mutable_control()->type()); - EXPECT_EQ(details, message->mutable_control()->mutable_size()); + EXPECT_EQ(TabControlMessage::SIZE, message->mutable_tab_control()->type()); + EXPECT_EQ(details, message->mutable_tab_control()->mutable_size()); } TEST(CreateBlimpMessageTest, StartConnectionMessage) { diff --git a/blimp/common/proto/BUILD.gn b/blimp/common/proto/BUILD.gn index 80d3d2a..3ed9400 100644 --- a/blimp/common/proto/BUILD.gn +++ b/blimp/common/proto/BUILD.gn @@ -27,12 +27,12 @@ proto_library("proto_internal") { sources = [ "blimp_message.proto", "compositor.proto", - "control.proto", "input.proto", "navigation.proto", "protocol_control.proto", "render_widget.proto", "size.proto", + "tab_control.proto", ] cc_generator_options = "dllexport_decl=BLIMP_PROTO_EXPORT:" diff --git a/blimp/common/proto/blimp_message.proto b/blimp/common/proto/blimp_message.proto index 3bf22f8..733c21fd 100644 --- a/blimp/common/proto/blimp_message.proto +++ b/blimp/common/proto/blimp_message.proto @@ -23,19 +23,19 @@ syntax = "proto2"; option optimize_for = LITE_RUNTIME; -import "control.proto"; import "compositor.proto"; import "input.proto"; import "navigation.proto"; import "render_widget.proto"; import "protocol_control.proto"; +import "tab_control.proto"; package blimp; message BlimpMessage { enum Type { UNKNOWN = 0; - CONTROL = 1; + TAB_CONTROL = 1; NAVIGATION = 2; RENDER_WIDGET = 3; INPUT = 4; @@ -67,7 +67,7 @@ message BlimpMessage { // Feature-specific messages follow. // Only one of these fields may be set per BlimpMessage. // TODO(kmarshall): use a 'oneof' union when it's supported in Chromium. - optional ControlMessage control = 1000; + optional TabControlMessage tab_control = 1000; optional NavigationMessage navigation = 1001; optional RenderWidgetMessage render_widget = 1002; optional InputMessage input = 1003; diff --git a/blimp/common/proto/control.proto b/blimp/common/proto/tab_control.proto index 8d29789..d71397c 100644 --- a/blimp/common/proto/control.proto +++ b/blimp/common/proto/tab_control.proto @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Message definitions for browser control messages. +// Message definitions for browser tab control messages. syntax = "proto2"; @@ -12,7 +12,7 @@ import "size.proto"; package blimp; -message ControlMessage { +message TabControlMessage { enum Type { UNKNOWN = 0; @@ -27,7 +27,7 @@ message ControlMessage { optional Type type = 1; // Feature-specific messages follow. - // Only one of these fields may be set per ControlMessage. + // Only one of these fields may be set per TabControlMessage. // TODO(kmarshall): use a 'oneof' union when it's supported in Chromium. optional SizeMessage size = 1000; } diff --git a/blimp/engine/browser/blimp_browser_main_parts.cc b/blimp/engine/browser/blimp_browser_main_parts.cc index e4fa842..992f740 100644 --- a/blimp/engine/browser/blimp_browser_main_parts.cc +++ b/blimp/engine/browser/blimp_browser_main_parts.cc @@ -43,8 +43,8 @@ void BlimpBrowserMainParts::PreMainMessageLoopRun() { // TODO(haibinlu): Remove these test messages and switch to using the // MessageDispatcher for incoming messages. scoped_ptr<BlimpMessage> message(new BlimpMessage); - message->set_type(BlimpMessage::CONTROL); - message->mutable_control()->set_type(ControlMessage::CREATE_TAB); + message->set_type(BlimpMessage::TAB_CONTROL); + message->mutable_tab_control()->set_type(TabControlMessage::CREATE_TAB); engine_session_->ProcessMessage(std::move(message), net::CompletionCallback()); message.reset(new BlimpMessage); diff --git a/blimp/engine/browser/blimp_engine_session.cc b/blimp/engine/browser/blimp_engine_session.cc index aa17d29a..3794db0 100644 --- a/blimp/engine/browser/blimp_engine_session.cc +++ b/blimp/engine/browser/blimp_engine_session.cc @@ -8,7 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "blimp/common/create_blimp_message.h" #include "blimp/common/proto/blimp_message.pb.h" -#include "blimp/common/proto/control.pb.h" +#include "blimp/common/proto/tab_control.pb.h" #include "blimp/engine/browser/blimp_browser_context.h" #include "blimp/engine/ui/blimp_layout_manager.h" #include "blimp/engine/ui/blimp_screen.h" @@ -197,20 +197,20 @@ void BlimpEngineSession::OnCompositorMessageReceived( void BlimpEngineSession::ProcessMessage( scoped_ptr<BlimpMessage> message, const net::CompletionCallback& callback) { - DCHECK(message->type() == BlimpMessage::CONTROL || - message->type() == BlimpMessage::NAVIGATION); + DCHECK(message->type() == BlimpMessage::TAB_CONTROL || + message->type() == BlimpMessage::NAVIGATION); - if (message->type() == BlimpMessage::CONTROL) { - switch (message->control().type()) { - case ControlMessage::CREATE_TAB: + if (message->type() == BlimpMessage::TAB_CONTROL) { + switch (message->tab_control().type()) { + case TabControlMessage::CREATE_TAB: CreateWebContents(message->target_tab_id()); break; - case ControlMessage::CLOSE_TAB: + case TabControlMessage::CLOSE_TAB: CloseWebContents(message->target_tab_id()); - case ControlMessage::SIZE: - HandleResize(message->control().size().device_pixel_ratio(), - gfx::Size(message->control().size().width(), - message->control().size().height())); + case TabControlMessage::SIZE: + HandleResize(message->tab_control().size().device_pixel_ratio(), + gfx::Size(message->tab_control().size().width(), + message->tab_control().size().height())); break; default: NOTIMPLEMENTED(); diff --git a/blimp/engine/browser/blimp_engine_session.h b/blimp/engine/browser/blimp_engine_session.h index 61f772b..3d8e695 100644 --- a/blimp/engine/browser/blimp_engine_session.h +++ b/blimp/engine/browser/blimp_engine_session.h @@ -70,7 +70,7 @@ class BlimpEngineSession const net::CompletionCallback& callback) override; private: - // ControlMessage handler methods. + // TabControlMessage handler methods. // Creates a new WebContents, which will be indexed by |target_tab_id|. void CreateWebContents(const int target_tab_id); void CloseWebContents(const int target_tab_id); diff --git a/blimp/net/blimp_connection_unittest.cc b/blimp/net/blimp_connection_unittest.cc index 759b426..8816b14 100644 --- a/blimp/net/blimp_connection_unittest.cc +++ b/blimp/net/blimp_connection_unittest.cc @@ -49,7 +49,7 @@ class BlimpConnectionTest : public testing::Test { scoped_ptr<BlimpMessage> CreateControlMessage() { scoped_ptr<BlimpMessage> msg(new BlimpMessage); - msg->set_type(BlimpMessage::CONTROL); + msg->set_type(BlimpMessage::TAB_CONTROL); return msg; } diff --git a/blimp/net/blimp_message_pump_unittest.cc b/blimp/net/blimp_message_pump_unittest.cc index 14b08c7..aede128 100644 --- a/blimp/net/blimp_message_pump_unittest.cc +++ b/blimp/net/blimp_message_pump_unittest.cc @@ -33,7 +33,7 @@ class BlimpMessagePumpTest : public testing::Test { BlimpMessagePumpTest() : message1_(new BlimpMessage), message2_(new BlimpMessage) { message1_->set_type(BlimpMessage::INPUT); - message2_->set_type(BlimpMessage::CONTROL); + message2_->set_type(BlimpMessage::TAB_CONTROL); message_pump_.reset(new BlimpMessagePump(&reader_)); message_pump_->set_error_observer(&error_observer_); } |