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

Side by Side Diff: chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc

Issue 2878133002: mash: Serialize ShelfIDs for property conversion and transport. (Closed)
Patch Set: Address comments. Created 3 years, 7 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h" 5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/public/cpp/window_properties.h" 10 #include "ash/public/cpp/window_properties.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 Browser* browser, 165 Browser* browser,
166 content::WebContents* web_contents) { 166 content::WebContents* web_contents) {
167 // We need to set the window ShelfID for V1 applications since they are 167 // We need to set the window ShelfID for V1 applications since they are
168 // content which might change and as such change the application type. 168 // content which might change and as such change the application type.
169 // The browser window may not exist in unit tests. 169 // The browser window may not exist in unit tests.
170 if (!browser || !browser->window() || !browser->window()->GetNativeWindow() || 170 if (!browser || !browser->window() || !browser->window()->GetNativeWindow() ||
171 !IsBrowserFromActiveUser(browser) || IsSettingsBrowser(browser)) { 171 !IsBrowserFromActiveUser(browser) || IsSettingsBrowser(browser)) {
172 return; 172 return;
173 } 173 }
174 174
175 const ash::ShelfID shelf_id =
176 ChromeLauncherController::instance()->GetShelfIDForWebContents(
177 web_contents);
175 browser->window()->GetNativeWindow()->SetProperty( 178 browser->window()->GetNativeWindow()->SetProperty(
176 ash::kShelfIDKey, 179 ash::kShelfIDKey, new std::string(shelf_id.Serialize()));
177 new ash::ShelfID(
178 ChromeLauncherController::instance()->GetShelfIDForWebContents(
179 web_contents)));
180 } 180 }
181 181
182 void BrowserShortcutLauncherItemController::ItemSelected( 182 void BrowserShortcutLauncherItemController::ItemSelected(
183 std::unique_ptr<ui::Event> event, 183 std::unique_ptr<ui::Event> event,
184 int64_t display_id, 184 int64_t display_id,
185 ash::ShelfLaunchSource source, 185 ash::ShelfLaunchSource source,
186 const ItemSelectedCallback& callback) { 186 const ItemSelectedCallback& callback) {
187 if (event && (event->flags() & ui::EF_CONTROL_DOWN)) { 187 if (event && (event->flags() & ui::EF_CONTROL_DOWN)) {
188 chrome::NewEmptyWindow(ChromeLauncherController::instance()->profile()); 188 chrome::NewEmptyWindow(ChromeLauncherController::instance()->profile());
189 callback.Run(ash::SHELF_ACTION_NEW_WINDOW_CREATED, base::nullopt); 189 callback.Run(ash::SHELF_ACTION_NEW_WINDOW_CREATED, base::nullopt);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 Browser* browser = content::Source<Browser>(source).ptr(); 398 Browser* browser = content::Source<Browser>(source).ptr();
399 DCHECK(browser); 399 DCHECK(browser);
400 BrowserList::BrowserVector::iterator item = std::find( 400 BrowserList::BrowserVector::iterator item = std::find(
401 browser_menu_items_.begin(), browser_menu_items_.end(), browser); 401 browser_menu_items_.begin(), browser_menu_items_.end(), browser);
402 DCHECK(item != browser_menu_items_.end()); 402 DCHECK(item != browser_menu_items_.end());
403 // Clear the entry for the closed browser and leave other indices intact. 403 // Clear the entry for the closed browser and leave other indices intact.
404 *item = nullptr; 404 *item = nullptr;
405 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING, 405 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING,
406 content::Source<Browser>(browser)); 406 content::Source<Browser>(browser));
407 } 407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698