| 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/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } else { | 341 } else { |
| 342 browser = chrome::FindTabbedBrowser(launcher_controller()->profile(), | 342 browser = chrome::FindTabbedBrowser(launcher_controller()->profile(), |
| 343 true, | 343 true, |
| 344 chrome::HOST_DESKTOP_TYPE_ASH); | 344 chrome::HOST_DESKTOP_TYPE_ASH); |
| 345 if (!browser || | 345 if (!browser || |
| 346 !IsBrowserRepresentedInBrowserList(browser)) | 346 !IsBrowserRepresentedInBrowserList(browser)) |
| 347 browser = items[0]; | 347 browser = items[0]; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 DCHECK(browser); | 350 DCHECK(browser); |
| 351 browser->window()->Show(); | 351 browser->window()->Show(true /* user_gesture */); |
| 352 browser->window()->Activate(true /* user_gesture */); | 352 browser->window()->Activate(true /* user_gesture */); |
| 353 return kExistingWindowActivated; | 353 return kExistingWindowActivated; |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( | 356 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( |
| 357 Browser* browser) { | 357 Browser* browser) { |
| 358 // Only Ash desktop browser windows for the active user are represented. | 358 // Only Ash desktop browser windows for the active user are represented. |
| 359 if (!browser || | 359 if (!browser || |
| 360 !launcher_controller()->IsBrowserFromActiveUser(browser) || | 360 !launcher_controller()->IsBrowserFromActiveUser(browser) || |
| 361 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) | 361 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) |
| 362 return false; | 362 return false; |
| 363 | 363 |
| 364 // v1 App popup windows with a valid app id have their own icon. | 364 // v1 App popup windows with a valid app id have their own icon. |
| 365 if (browser->is_app() && | 365 if (browser->is_app() && |
| 366 browser->is_type_popup() && | 366 browser->is_type_popup() && |
| 367 launcher_controller()->GetShelfIDForAppID( | 367 launcher_controller()->GetShelfIDForAppID( |
| 368 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) | 368 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) |
| 369 return false; | 369 return false; |
| 370 | 370 |
| 371 // Settings browsers have their own icon. | 371 // Settings browsers have their own icon. |
| 372 if (IsSettingsBrowser(browser)) | 372 if (IsSettingsBrowser(browser)) |
| 373 return false; | 373 return false; |
| 374 | 374 |
| 375 // Tabbed browser and other popup windows are all represented. | 375 // Tabbed browser and other popup windows are all represented. |
| 376 return true; | 376 return true; |
| 377 } | 377 } |
| OLD | NEW |