OLD | NEW |
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/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
10 #include "ash/common/shelf/shelf_delegate.h" | 10 #include "ash/common/shelf/shelf_delegate.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 void BrowserShortcutLauncherItemController::Close() { | 163 void BrowserShortcutLauncherItemController::Close() { |
164 for (auto* browser : GetListOfActiveBrowsers()) | 164 for (auto* browser : GetListOfActiveBrowsers()) |
165 browser->window()->Close(); | 165 browser->window()->Close(); |
166 } | 166 } |
167 | 167 |
168 ChromeLauncherAppMenuItems | 168 ChromeLauncherAppMenuItems |
169 BrowserShortcutLauncherItemController::GetApplicationList(int event_flags) { | 169 BrowserShortcutLauncherItemController::GetApplicationList(int event_flags) { |
170 ChromeLauncherAppMenuItems items; | 170 ChromeLauncherAppMenuItems items; |
171 bool found_tabbed_browser = false; | 171 bool found_tabbed_browser = false; |
172 // Add the application name to the menu. | 172 // Add the application name to the menu. |
| 173 base::string16 app_title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
173 items.push_back( | 174 items.push_back( |
174 base::MakeUnique<ChromeLauncherAppMenuItem>(GetTitle(), nullptr, false)); | 175 base::MakeUnique<ChromeLauncherAppMenuItem>(app_title, nullptr, false)); |
175 for (auto* browser : GetListOfActiveBrowsers()) { | 176 for (auto* browser : GetListOfActiveBrowsers()) { |
176 TabStripModel* tab_strip = browser->tab_strip_model(); | 177 TabStripModel* tab_strip = browser->tab_strip_model(); |
177 if (tab_strip->active_index() == -1) | 178 if (tab_strip->active_index() == -1) |
178 continue; | 179 continue; |
179 if (browser->is_type_tabbed()) | 180 if (browser->is_type_tabbed()) |
180 found_tabbed_browser = true; | 181 found_tabbed_browser = true; |
181 if (!(event_flags & ui::EF_SHIFT_DOWN)) { | 182 if (!(event_flags & ui::EF_SHIFT_DOWN)) { |
182 content::WebContents* web_contents = | 183 content::WebContents* web_contents = |
183 tab_strip->GetWebContentsAt(tab_strip->active_index()); | 184 tab_strip->GetWebContentsAt(tab_strip->active_index()); |
184 gfx::Image app_icon = GetBrowserListIcon(web_contents); | 185 gfx::Image app_icon = GetBrowserListIcon(web_contents); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 217 |
217 // In case of a keyboard event, we were called by a hotkey. In that case we | 218 // In case of a keyboard event, we were called by a hotkey. In that case we |
218 // activate the next item in line if an item of our list is already active. | 219 // activate the next item in line if an item of our list is already active. |
219 if (event.type() == ui::ET_KEY_RELEASED) { | 220 if (event.type() == ui::ET_KEY_RELEASED) { |
220 return ActivateOrAdvanceToNextBrowser(); | 221 return ActivateOrAdvanceToNextBrowser(); |
221 } | 222 } |
222 | 223 |
223 return Activate(ash::LAUNCH_FROM_UNKNOWN); | 224 return Activate(ash::LAUNCH_FROM_UNKNOWN); |
224 } | 225 } |
225 | 226 |
226 base::string16 BrowserShortcutLauncherItemController::GetTitle() { | |
227 return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | |
228 } | |
229 | |
230 ash::ShelfMenuModel* | 227 ash::ShelfMenuModel* |
231 BrowserShortcutLauncherItemController::CreateApplicationMenu(int event_flags) { | 228 BrowserShortcutLauncherItemController::CreateApplicationMenu(int event_flags) { |
232 return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags)); | 229 return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags)); |
233 } | 230 } |
234 | 231 |
235 bool BrowserShortcutLauncherItemController::IsListOfActiveBrowserEmpty() { | 232 bool BrowserShortcutLauncherItemController::IsListOfActiveBrowserEmpty() { |
236 return GetListOfActiveBrowsers().empty(); | 233 return GetListOfActiveBrowsers().empty(); |
237 } | 234 } |
238 | 235 |
239 gfx::Image BrowserShortcutLauncherItemController::GetBrowserListIcon( | 236 gfx::Image BrowserShortcutLauncherItemController::GetBrowserListIcon( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 !browser->window()->IsMinimized()) { | 336 !browser->window()->IsMinimized()) { |
340 continue; | 337 continue; |
341 } | 338 } |
342 if (!IsBrowserRepresentedInBrowserList(browser) && | 339 if (!IsBrowserRepresentedInBrowserList(browser) && |
343 !browser->is_type_tabbed()) | 340 !browser->is_type_tabbed()) |
344 continue; | 341 continue; |
345 active_browsers.push_back(browser); | 342 active_browsers.push_back(browser); |
346 } | 343 } |
347 return active_browsers; | 344 return active_browsers; |
348 } | 345 } |
OLD | NEW |