Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: blimp/client/core/contents/blimp_contents_manager.cc

Issue 2270323004: Add BlimpView to a Chrome tab when Blimp is enabled. (Closed)
Patch Set: addressed nit, renamed CreateForTesting and piped through touch handling Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/compositor/blimp_compositor_dependencies.h" 10 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 TabControlFeature* tab_control_feature) 56 TabControlFeature* tab_control_feature)
57 : blimp_compositor_dependencies_(blimp_compositor_dependencies), 57 : blimp_compositor_dependencies_(blimp_compositor_dependencies),
58 ime_feature_(ime_feature), 58 ime_feature_(ime_feature),
59 navigation_feature_(nav_feature), 59 navigation_feature_(nav_feature),
60 render_widget_feature_(render_widget_feature), 60 render_widget_feature_(render_widget_feature),
61 tab_control_feature_(tab_control_feature), 61 tab_control_feature_(tab_control_feature),
62 weak_ptr_factory_(this) {} 62 weak_ptr_factory_(this) {}
63 63
64 BlimpContentsManager::~BlimpContentsManager() {} 64 BlimpContentsManager::~BlimpContentsManager() {}
65 65
66 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() { 66 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents(
67 gfx::NativeWindow window) {
67 if (tab_exists_) return nullptr; 68 if (tab_exists_) return nullptr;
68 tab_exists_ = true; 69 tab_exists_ = true;
69 70
70 int id = CreateBlimpContentsId(); 71 int id = CreateBlimpContentsId();
71 72
72 std::unique_ptr<BlimpContentsImpl> new_contents = 73 std::unique_ptr<BlimpContentsImpl> new_contents =
73 base::MakeUnique<BlimpContentsImpl>( 74 base::MakeUnique<BlimpContentsImpl>(
74 id, blimp_compositor_dependencies_, ime_feature_, navigation_feature_, 75 id, window, blimp_compositor_dependencies_, ime_feature_,
75 render_widget_feature_, tab_control_feature_); 76 navigation_feature_, render_widget_feature_, tab_control_feature_);
76 77
77 // Create an observer entry for the contents. 78 // Create an observer entry for the contents.
78 std::unique_ptr<BlimpContentsDeletionObserver> observer = 79 std::unique_ptr<BlimpContentsDeletionObserver> observer =
79 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); 80 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get());
80 observer_map_.insert( 81 observer_map_.insert(
81 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( 82 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>(
82 id, std::move(observer))); 83 id, std::move(observer)));
83 84
84 // Notifies the engine that we've created a new BlimpContents. 85 // Notifies the engine that we've created a new BlimpContents.
85 tab_control_feature_->CreateTab(id); 86 tab_control_feature_->CreateTab(id);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, 127 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap,
127 this->GetWeakPtr(), id)); 128 this->GetWeakPtr(), id));
128 } 129 }
129 130
130 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { 131 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() {
131 return weak_ptr_factory_.GetWeakPtr(); 132 return weak_ptr_factory_.GetWeakPtr();
132 } 133 }
133 134
134 } // namespace client 135 } // namespace client
135 } // namespace blimp 136 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/contents/blimp_contents_manager.h ('k') | blimp/client/core/contents/blimp_contents_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698