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

Side by Side Diff: ash/test/test_shelf_delegate.cc

Issue 2290603002: Enhance chrome.app.window API for shelf integration with pinning support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/test/test_shelf_delegate.h" 5 #include "ash/test/test_shelf_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/shelf/shelf_util.h" 10 #include "ash/shelf/shelf_util.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void TestShelfDelegate::OnShelfVisibilityStateChanged(WmShelf* shelf) {} 98 void TestShelfDelegate::OnShelfVisibilityStateChanged(WmShelf* shelf) {}
99 99
100 ShelfID TestShelfDelegate::GetShelfIDForAppID(const std::string& app_id) { 100 ShelfID TestShelfDelegate::GetShelfIDForAppID(const std::string& app_id) {
101 for (auto const& iter : shelf_id_to_app_id_map_) { 101 for (auto const& iter : shelf_id_to_app_id_map_) {
102 if (iter.second == app_id) 102 if (iter.second == app_id)
103 return iter.first; 103 return iter.first;
104 } 104 }
105 return 0; 105 return 0;
106 } 106 }
107 107
108 ShelfID TestShelfDelegate::GetShelfIDForAppIDAndLaunchID(
109 const std::string& app_id,
110 const std::string& /* launch_id */) {
111 for (auto const& iter : shelf_id_to_app_id_map_) {
112 if (iter.second == app_id)
113 return iter.first;
114 }
115 return 0;
stevenjb 2016/08/30 16:12:51 Instead of copy/pasting identical code, just retur
Andra Paraschiv 2016/08/31 10:57:18 Done.
116 }
117
108 bool TestShelfDelegate::HasShelfIDToAppIDMapping(ShelfID id) const { 118 bool TestShelfDelegate::HasShelfIDToAppIDMapping(ShelfID id) const {
109 return shelf_id_to_app_id_map_.find(id) != shelf_id_to_app_id_map_.end(); 119 return shelf_id_to_app_id_map_.find(id) != shelf_id_to_app_id_map_.end();
110 } 120 }
111 121
112 const std::string& TestShelfDelegate::GetAppIDForShelfID(ShelfID id) { 122 const std::string& TestShelfDelegate::GetAppIDForShelfID(ShelfID id) {
113 DCHECK_GT(shelf_id_to_app_id_map_.count(id), 0u); 123 DCHECK_GT(shelf_id_to_app_id_map_.count(id), 0u);
114 return shelf_id_to_app_id_map_[id]; 124 return shelf_id_to_app_id_map_[id];
115 } 125 }
116 126
117 void TestShelfDelegate::PinAppWithID(const std::string& app_id) { 127 void TestShelfDelegate::PinAppWithID(const std::string& app_id) {
(...skipping 12 matching lines...) Expand all
130 const std::string& app_id) { 140 const std::string& app_id) {
131 shelf_id_to_app_id_map_[shelf_id] = app_id; 141 shelf_id_to_app_id_map_[shelf_id] = app_id;
132 } 142 }
133 143
134 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { 144 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) {
135 shelf_id_to_app_id_map_.erase(shelf_id); 145 shelf_id_to_app_id_map_.erase(shelf_id);
136 } 146 }
137 147
138 } // namespace test 148 } // namespace test
139 } // namespace ash 149 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698