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

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

Issue 2684723003: Remove LauncherItemController::Launch, cleanup. (Closed)
Patch Set: Use AppLauncherId Created 3 years, 10 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 <vector> 7 #include <vector>
8 8
9 #include "ash/common/shelf/shelf_delegate.h" 9 #include "ash/common/shelf/shelf_delegate.h"
10 #include "ash/common/shelf/shelf_model.h" 10 #include "ash/common/shelf/shelf_model.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return true; 57 return true;
58 return false; 58 return false;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 BrowserShortcutLauncherItemController::BrowserShortcutLauncherItemController( 63 BrowserShortcutLauncherItemController::BrowserShortcutLauncherItemController(
64 ChromeLauncherController* launcher_controller, 64 ChromeLauncherController* launcher_controller,
65 ash::ShelfModel* shelf_model) 65 ash::ShelfModel* shelf_model)
66 : LauncherItemController(extension_misc::kChromeAppId, 66 : LauncherItemController(extension_misc::kChromeAppId,
67 "", 67 std::string(),
68 launcher_controller), 68 launcher_controller),
69 shelf_model_(shelf_model) {} 69 shelf_model_(shelf_model) {}
70 70
71 BrowserShortcutLauncherItemController:: 71 BrowserShortcutLauncherItemController::
72 ~BrowserShortcutLauncherItemController() { 72 ~BrowserShortcutLauncherItemController() {}
73 }
74 73
75 void BrowserShortcutLauncherItemController::UpdateBrowserItemState() { 74 void BrowserShortcutLauncherItemController::UpdateBrowserItemState() {
76 // Determine the new browser's active state and change if necessary. 75 // Determine the new browser's active state and change if necessary.
77 int browser_index = 76 int browser_index =
78 shelf_model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); 77 shelf_model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT);
79 DCHECK_GE(browser_index, 0); 78 DCHECK_GE(browser_index, 0);
80 ash::ShelfItem browser_item = shelf_model_->items()[browser_index]; 79 ash::ShelfItem browser_item = shelf_model_->items()[browser_index];
81 ash::ShelfItemStatus browser_status = ash::STATUS_CLOSED; 80 ash::ShelfItemStatus browser_status = ash::STATUS_CLOSED;
82 81
83 aura::Window* window = ash::wm::GetActiveWindow(); 82 aura::Window* window = ash::wm::GetActiveWindow();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (!browser || !IsBrowserFromActiveUser(browser) || 121 if (!browser || !IsBrowserFromActiveUser(browser) ||
123 IsSettingsBrowser(browser)) 122 IsSettingsBrowser(browser))
124 return; 123 return;
125 124
126 ash::WmWindow::Get(browser->window()->GetNativeWindow()) 125 ash::WmWindow::Get(browser->window()->GetNativeWindow())
127 ->SetIntProperty( 126 ->SetIntProperty(
128 ash::WmWindowProperty::SHELF_ID, 127 ash::WmWindowProperty::SHELF_ID,
129 launcher_controller()->GetShelfIDForWebContents(web_contents)); 128 launcher_controller()->GetShelfIDForWebContents(web_contents));
130 } 129 }
131 130
132 void BrowserShortcutLauncherItemController::Launch(ash::LaunchSource source,
133 int event_flags) {
134 }
135
136 ash::ShelfItemDelegate::PerformedAction 131 ash::ShelfItemDelegate::PerformedAction
137 BrowserShortcutLauncherItemController::Activate(ash::LaunchSource source) { 132 BrowserShortcutLauncherItemController::Activate(ash::LaunchSource source) {
138 Browser* last_browser = 133 Browser* last_browser =
139 chrome::FindTabbedBrowser(launcher_controller()->profile(), true); 134 chrome::FindTabbedBrowser(launcher_controller()->profile(), true);
140 135
141 if (!last_browser) { 136 if (!last_browser) {
142 chrome::NewEmptyWindow(launcher_controller()->profile()); 137 chrome::NewEmptyWindow(launcher_controller()->profile());
143 return kNewWindowCreated; 138 return kNewWindowCreated;
144 } 139 }
145 140
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 !browser->window()->IsMinimized()) { 306 !browser->window()->IsMinimized()) {
312 continue; 307 continue;
313 } 308 }
314 if (!IsBrowserRepresentedInBrowserList(browser) && 309 if (!IsBrowserRepresentedInBrowserList(browser) &&
315 !browser->is_type_tabbed()) 310 !browser->is_type_tabbed())
316 continue; 311 continue;
317 active_browsers.push_back(browser); 312 active_browsers.push_back(browser);
318 } 313 }
319 return active_browsers; 314 return active_browsers;
320 } 315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698