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/public/contents/blimp_contents_observer.h" | 10 #include "blimp/client/public/contents/blimp_contents_observer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 DCHECK(base::ThreadTaskRunnerHandle::Get()); | 44 DCHECK(base::ThreadTaskRunnerHandle::Get()); |
45 base::ThreadTaskRunnerHandle::Get()->PostTask( | 45 base::ThreadTaskRunnerHandle::Get()->PostTask( |
46 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, | 46 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, |
47 blimp_contents_manager_->GetWeakPtr(), id)); | 47 blimp_contents_manager_->GetWeakPtr(), id)); |
48 } | 48 } |
49 | 49 |
50 BlimpContentsManager::BlimpContentsManager() : weak_ptr_factory_(this) {} | 50 BlimpContentsManager::BlimpContentsManager() : weak_ptr_factory_(this) {} |
51 | 51 |
52 BlimpContentsManager::~BlimpContentsManager() {} | 52 BlimpContentsManager::~BlimpContentsManager() {} |
53 | 53 |
54 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() { | 54 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents( |
| 55 NavigationFeature* nav_feature, |
| 56 ImeFeature* ime_feature) { |
55 int id = CreateBlimpContentsId(); | 57 int id = CreateBlimpContentsId(); |
56 std::unique_ptr<BlimpContentsImpl> new_contents = | 58 std::unique_ptr<BlimpContentsImpl> new_contents = |
57 base::MakeUnique<BlimpContentsImpl>(id); | 59 base::MakeUnique<BlimpContentsImpl>(id, nav_feature, ime_feature); |
58 std::unique_ptr<BlimpContentsDeletionObserver> observer = | 60 std::unique_ptr<BlimpContentsDeletionObserver> observer = |
59 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); | 61 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); |
60 observer_map_.insert( | 62 observer_map_.insert( |
61 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( | 63 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( |
62 id, std::move(observer))); | 64 id, std::move(observer))); |
63 return new_contents; | 65 return new_contents; |
64 } | 66 } |
65 | 67 |
66 BlimpContentsImpl* BlimpContentsManager::GetBlimpContents(int id) { | 68 BlimpContentsImpl* BlimpContentsManager::GetBlimpContents(int id) { |
67 if (observer_map_.find(id) == observer_map_.end()) return nullptr; | 69 if (observer_map_.find(id) == observer_map_.end()) return nullptr; |
(...skipping 18 matching lines...) Expand all Loading... |
86 void BlimpContentsManager::EraseObserverFromMap(int id) { | 88 void BlimpContentsManager::EraseObserverFromMap(int id) { |
87 observer_map_.erase(id); | 89 observer_map_.erase(id); |
88 } | 90 } |
89 | 91 |
90 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { | 92 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { |
91 return weak_ptr_factory_.GetWeakPtr(); | 93 return weak_ptr_factory_.GetWeakPtr(); |
92 } | 94 } |
93 | 95 |
94 } // namespace client | 96 } // namespace client |
95 } // namespace blimp | 97 } // namespace blimp |
OLD | NEW |