| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ImeFeature* ime_feature, | 48 ImeFeature* ime_feature, |
| 49 NavigationFeature* nav_feature, | 49 NavigationFeature* nav_feature, |
| 50 TabControlFeature* tab_control_feature) | 50 TabControlFeature* tab_control_feature) |
| 51 : ime_feature_(ime_feature), | 51 : ime_feature_(ime_feature), |
| 52 navigation_feature_(nav_feature), | 52 navigation_feature_(nav_feature), |
| 53 tab_control_feature_(tab_control_feature), | 53 tab_control_feature_(tab_control_feature), |
| 54 weak_ptr_factory_(this) {} | 54 weak_ptr_factory_(this) {} |
| 55 | 55 |
| 56 BlimpContentsManager::~BlimpContentsManager() {} | 56 BlimpContentsManager::~BlimpContentsManager() {} |
| 57 | 57 |
| 58 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() { | 58 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents( |
| 59 gfx::NativeWindow window) { |
| 59 int id = CreateBlimpContentsId(); | 60 int id = CreateBlimpContentsId(); |
| 60 | 61 |
| 61 std::unique_ptr<BlimpContentsImpl> new_contents = | 62 std::unique_ptr<BlimpContentsImpl> new_contents = |
| 62 base::MakeUnique<BlimpContentsImpl>(id, ime_feature_, navigation_feature_, | 63 base::MakeUnique<BlimpContentsImpl>( |
| 63 tab_control_feature_); | 64 id, window, ime_feature_, navigation_feature_, tab_control_feature_); |
| 64 | 65 |
| 65 // Create an observer entry for the contents. | 66 // Create an observer entry for the contents. |
| 66 std::unique_ptr<BlimpContentsDeletionObserver> observer = | 67 std::unique_ptr<BlimpContentsDeletionObserver> observer = |
| 67 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); | 68 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); |
| 68 observer_map_.insert( | 69 observer_map_.insert( |
| 69 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( | 70 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( |
| 70 id, std::move(observer))); | 71 id, std::move(observer))); |
| 71 | 72 |
| 72 // Notifies the engine that we've created a new BlimpContents. | 73 // Notifies the engine that we've created a new BlimpContents. |
| 73 tab_control_feature_->CreateTab(id); | 74 tab_control_feature_->CreateTab(id); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, | 112 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, |
| 112 this->GetWeakPtr(), id)); | 113 this->GetWeakPtr(), id)); |
| 113 } | 114 } |
| 114 | 115 |
| 115 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { | 116 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { |
| 116 return weak_ptr_factory_.GetWeakPtr(); | 117 return weak_ptr_factory_.GetWeakPtr(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 } // namespace client | 120 } // namespace client |
| 120 } // namespace blimp | 121 } // namespace blimp |
| OLD | NEW |