Chromium Code Reviews| Index: blimp/client/core/blimp_client_context_impl.cc |
| diff --git a/blimp/client/core/blimp_client_context_impl.cc b/blimp/client/core/blimp_client_context_impl.cc |
| index f90b1dc02b222929b3e0851a1a240809064d7aa0..95fccdc5752ccf7cfb7d96fbae34b92029c4a894 100644 |
| --- a/blimp/client/core/blimp_client_context_impl.cc |
| +++ b/blimp/client/core/blimp_client_context_impl.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/threading/sequenced_task_runner_handle.h" |
| #include "blimp/client/core/contents/blimp_contents_impl.h" |
| #include "blimp/client/core/contents/blimp_contents_manager.h" |
| +#include "blimp/client/core/contents/tab_control_feature.h" |
| #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
| #include "blimp/client/public/blimp_client_context_delegate.h" |
| @@ -23,6 +24,7 @@ namespace client { |
| namespace { |
| const char kDefaultAssignerUrl[] = |
| "https://blimp-pa.googleapis.com/v1/assignment"; |
| +const int kDummyTabId = 0; |
| } // namespace |
| // This function is declared in //blimp/client/public/blimp_client_context.h, |
| @@ -49,6 +51,7 @@ BlimpClientContextImpl::BlimpClientContextImpl( |
| io_thread_task_runner_(io_thread_task_runner), |
| file_thread_task_runner_(file_thread_task_runner), |
| blimp_contents_manager_(new BlimpContentsManager), |
| + tab_control_feature_(new TabControlFeature), |
| weak_factory_(this) { |
| net_components_.reset(new ClientNetworkComponents( |
| base::MakeUnique<CrossThreadNetworkEventObserver>( |
| @@ -59,11 +62,17 @@ BlimpClientContextImpl::BlimpClientContextImpl( |
| thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( |
| io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); |
| + RegisterFeatures(); |
| + |
| // Initialize must only be posted after the calls features have been |
| // registered. |
| io_thread_task_runner_->PostTask( |
| FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, |
| base::Unretained(net_components_.get()))); |
| + |
| + // Create a single tab's WebContents. |
| + // TODO(kmarshall): Remove this once we add tab-literacy to Blimp. |
| + GetTabControlFeature()->CreateTab(kDummyTabId); |
|
David Trainor- moved to gerrit
2016/08/18 17:41:58
We don't need this. It'll be driven by the Chrome
Menglin
2016/08/19 00:50:21
Done.
|
| } |
| BlimpClientContextImpl::~BlimpClientContextImpl() { |
| @@ -76,7 +85,7 @@ void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents() { |
| std::unique_ptr<BlimpContents> blimp_contents = |
| - blimp_contents_manager_->CreateBlimpContents(); |
| + blimp_contents_manager_->CreateBlimpContents(tab_control_feature_.get()); |
| delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); |
| return blimp_contents; |
| } |
| @@ -98,6 +107,10 @@ void BlimpClientContextImpl::OnConnected() {} |
| void BlimpClientContextImpl::OnDisconnected(int result) {} |
| +TabControlFeature* BlimpClientContextImpl::GetTabControlFeature() const { |
| + return tab_control_feature_.get(); |
| +} |
| + |
| GURL BlimpClientContextImpl::GetAssignerURL() { |
| return GURL(kDefaultAssignerUrl); |
| } |
| @@ -122,5 +135,12 @@ void BlimpClientContextImpl::ConnectWithAssignment( |
| base::Unretained(net_components_.get()), assignment)); |
| } |
| +void BlimpClientContextImpl::RegisterFeatures() { |
| + // Register features' message senders and receivers. |
| + tab_control_feature_->set_outgoing_message_processor( |
| + thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, |
| + tab_control_feature_.get())); |
| +} |
| + |
| } // namespace client |
| } // namespace blimp |