| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/client/core/contents/blimp_contents_manager.h" | 5 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "blimp/client/core/contents/tab_control_feature.h" | 10 #include "blimp/client/core/contents/tab_control_feature.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 : BlimpContentsObserver(blimp_contents), | 38 : BlimpContentsObserver(blimp_contents), |
| 39 blimp_contents_manager_(blimp_contents_manager) {} | 39 blimp_contents_manager_(blimp_contents_manager) {} |
| 40 | 40 |
| 41 void BlimpContentsManager::BlimpContentsDeletionObserver:: | 41 void BlimpContentsManager::BlimpContentsDeletionObserver:: |
| 42 OnContentsDestroyed() { | 42 OnContentsDestroyed() { |
| 43 BlimpContents* contents = blimp_contents(); | 43 BlimpContents* contents = blimp_contents(); |
| 44 blimp_contents_manager_->OnContentsDestroyed(contents); | 44 blimp_contents_manager_->OnContentsDestroyed(contents); |
| 45 } | 45 } |
| 46 | 46 |
| 47 BlimpContentsManager::BlimpContentsManager( | 47 BlimpContentsManager::BlimpContentsManager( |
| 48 ImeFeature* ime_feature, |
| 49 NavigationFeature* nav_feature, |
| 48 TabControlFeature* tab_control_feature) | 50 TabControlFeature* tab_control_feature) |
| 49 : tab_control_feature_(tab_control_feature), | 51 : ime_feature_(ime_feature), |
| 52 navigation_feature_(nav_feature), |
| 53 tab_control_feature_(tab_control_feature), |
| 50 weak_ptr_factory_(this) {} | 54 weak_ptr_factory_(this) {} |
| 51 | 55 |
| 52 BlimpContentsManager::~BlimpContentsManager() {} | 56 BlimpContentsManager::~BlimpContentsManager() {} |
| 53 | 57 |
| 54 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() { | 58 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() { |
| 55 int id = CreateBlimpContentsId(); | 59 int id = CreateBlimpContentsId(); |
| 56 | 60 |
| 57 std::unique_ptr<BlimpContentsImpl> new_contents = | 61 std::unique_ptr<BlimpContentsImpl> new_contents = |
| 58 base::MakeUnique<BlimpContentsImpl>(id, tab_control_feature_); | 62 base::MakeUnique<BlimpContentsImpl>(id, ime_feature_, navigation_feature_, |
| 63 tab_control_feature_); |
| 59 | 64 |
| 60 // Create an observer entry for the contents. | 65 // Create an observer entry for the contents. |
| 61 std::unique_ptr<BlimpContentsDeletionObserver> observer = | 66 std::unique_ptr<BlimpContentsDeletionObserver> observer = |
| 62 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); | 67 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); |
| 63 observer_map_.insert( | 68 observer_map_.insert( |
| 64 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( | 69 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( |
| 65 id, std::move(observer))); | 70 id, std::move(observer))); |
| 66 | 71 |
| 67 // Notifies the engine that we've created a new BlimpContents. | 72 // Notifies the engine that we've created a new BlimpContents. |
| 68 tab_control_feature_->CreateTab(id); | 73 tab_control_feature_->CreateTab(id); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, | 111 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, |
| 107 this->GetWeakPtr(), id)); | 112 this->GetWeakPtr(), id)); |
| 108 } | 113 } |
| 109 | 114 |
| 110 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { | 115 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { |
| 111 return weak_ptr_factory_.GetWeakPtr(); | 116 return weak_ptr_factory_.GetWeakPtr(); |
| 112 } | 117 } |
| 113 | 118 |
| 114 } // namespace client | 119 } // namespace client |
| 115 } // namespace blimp | 120 } // namespace blimp |
| OLD | NEW |