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_model.h" | 9 #include "ash/shelf/shelf_model.h" |
10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 browser_item.status = browser_status; | 117 browser_item.status = browser_status; |
118 model->Set(browser_index, browser_item); | 118 model->Set(browser_index, browser_item); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( | 122 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( |
123 Browser* browser, | 123 Browser* browser, |
124 content::WebContents* web_contents) { | 124 content::WebContents* web_contents) { |
125 // We need to call SetShelfIDForWindow for V1 applications since they are | 125 // We need to call SetShelfIDForWindow for V1 applications since they are |
126 // content which might change and as such change the application type. | 126 // content which might change and as such change the application type. |
127 if (!browser || | 127 if (!browser || !launcher_controller()->IsBrowserFromActiveUser(browser) || |
128 !launcher_controller()->IsBrowserFromActiveUser(browser) || | |
129 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || | |
130 IsSettingsBrowser(browser)) | 128 IsSettingsBrowser(browser)) |
131 return; | 129 return; |
132 | 130 |
133 ash::SetShelfIDForWindow( | 131 ash::SetShelfIDForWindow( |
134 launcher_controller()->GetShelfIDForWebContents(web_contents), | 132 launcher_controller()->GetShelfIDForWebContents(web_contents), |
135 browser->window()->GetNativeWindow()); | 133 browser->window()->GetNativeWindow()); |
136 } | 134 } |
137 | 135 |
138 bool BrowserShortcutLauncherItemController::IsOpen() const { | 136 bool BrowserShortcutLauncherItemController::IsOpen() const { |
139 const BrowserList* browser_list = BrowserList::GetInstance(); | 137 const BrowserList* browser_list = BrowserList::GetInstance(); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 337 } |
340 DCHECK(browser); | 338 DCHECK(browser); |
341 browser->window()->Show(); | 339 browser->window()->Show(); |
342 browser->window()->Activate(); | 340 browser->window()->Activate(); |
343 return kExistingWindowActivated; | 341 return kExistingWindowActivated; |
344 } | 342 } |
345 | 343 |
346 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( | 344 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( |
347 Browser* browser) { | 345 Browser* browser) { |
348 // Only Ash desktop browser windows for the active user are represented. | 346 // Only Ash desktop browser windows for the active user are represented. |
349 if (!browser || | 347 if (!browser || !launcher_controller()->IsBrowserFromActiveUser(browser)) |
350 !launcher_controller()->IsBrowserFromActiveUser(browser) || | |
351 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) | |
352 return false; | 348 return false; |
353 | 349 |
354 // v1 App popup windows with a valid app id have their own icon. | 350 // v1 App popup windows with a valid app id have their own icon. |
355 if (browser->is_app() && | 351 if (browser->is_app() && |
356 browser->is_type_popup() && | 352 browser->is_type_popup() && |
357 launcher_controller()->GetShelfIDForAppID( | 353 launcher_controller()->GetShelfIDForAppID( |
358 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) | 354 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) |
359 return false; | 355 return false; |
360 | 356 |
361 // Settings browsers have their own icon. | 357 // Settings browsers have their own icon. |
362 if (IsSettingsBrowser(browser)) | 358 if (IsSettingsBrowser(browser)) |
363 return false; | 359 return false; |
364 | 360 |
365 // Tabbed browser and other popup windows are all represented. | 361 // Tabbed browser and other popup windows are all represented. |
366 return true; | 362 return true; |
367 } | 363 } |
OLD | NEW |