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

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

Issue 2731663002: Remove WmWindowProperty (Closed)
Patch Set: rebase Created 3 years, 9 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/common/shelf/shelf_delegate.h" 10 #include "ash/common/shelf/shelf_delegate.h"
11 #include "ash/common/shelf/shelf_model.h" 11 #include "ash/common/shelf/shelf_model.h"
12 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
13 #include "ash/common/wm_window.h" 13 #include "ash/common/wm_window.h"
14 #include "ash/common/wm_window_property.h"
15 #include "ash/public/cpp/shelf_application_menu_item.h" 14 #include "ash/public/cpp/shelf_application_menu_item.h"
16 #include "ash/resources/grit/ash_resources.h" 15 #include "ash/resources/grit/ash_resources.h"
16 #include "ash/wm/window_properties.h"
17 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
23 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 23 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
25 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_commands.h" 26 #include "chrome/browser/ui/browser_commands.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( 172 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents(
173 Browser* browser, 173 Browser* browser,
174 content::WebContents* web_contents) { 174 content::WebContents* web_contents) {
175 // We need to set the window ShelfID for V1 applications since they are 175 // We need to set the window ShelfID for V1 applications since they are
176 // content which might change and as such change the application type. 176 // content which might change and as such change the application type.
177 if (!browser || !IsBrowserFromActiveUser(browser) || 177 if (!browser || !IsBrowserFromActiveUser(browser) ||
178 IsSettingsBrowser(browser)) 178 IsSettingsBrowser(browser))
179 return; 179 return;
180 180
181 ash::WmWindow::Get(browser->window()->GetNativeWindow()) 181 browser->window()->GetNativeWindow()->SetProperty(
182 ->SetIntProperty( 182 ash::kShelfIDKey,
183 ash::WmWindowProperty::SHELF_ID, 183 launcher_controller()->GetShelfIDForWebContents(web_contents));
184 launcher_controller()->GetShelfIDForWebContents(web_contents));
185 } 184 }
186 185
187 ash::ShelfAction BrowserShortcutLauncherItemController::ItemSelected( 186 ash::ShelfAction BrowserShortcutLauncherItemController::ItemSelected(
188 ui::EventType event_type, 187 ui::EventType event_type,
189 int event_flags, 188 int event_flags,
190 int64_t display_id, 189 int64_t display_id,
191 ash::ShelfLaunchSource source) { 190 ash::ShelfLaunchSource source) {
192 if (event_flags & ui::EF_CONTROL_DOWN) { 191 if (event_flags & ui::EF_CONTROL_DOWN) {
193 chrome::NewEmptyWindow(launcher_controller()->profile()); 192 chrome::NewEmptyWindow(launcher_controller()->profile());
194 return ash::SHELF_ACTION_NEW_WINDOW_CREATED; 193 return ash::SHELF_ACTION_NEW_WINDOW_CREATED;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 Browser* browser = content::Source<Browser>(source).ptr(); 392 Browser* browser = content::Source<Browser>(source).ptr();
394 DCHECK(browser); 393 DCHECK(browser);
395 BrowserList::BrowserVector::iterator item = std::find( 394 BrowserList::BrowserVector::iterator item = std::find(
396 browser_menu_items_.begin(), browser_menu_items_.end(), browser); 395 browser_menu_items_.begin(), browser_menu_items_.end(), browser);
397 DCHECK(item != browser_menu_items_.end()); 396 DCHECK(item != browser_menu_items_.end());
398 // Clear the entry for the closed browser and leave other indices intact. 397 // Clear the entry for the closed browser and leave other indices intact.
399 *item = nullptr; 398 *item = nullptr;
400 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING, 399 registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSING,
401 content::Source<Browser>(browser)); 400 content::Source<Browser>(browser));
402 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698