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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 | 115 |
116 if (browser_status != browser_item.status) { | 116 if (browser_status != browser_item.status) { |
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 #if !defined(USE_ASH) | |
sky
2016/03/15 23:52:56
Why are we compiling this file if not ash?
scottmg
2016/03/16 01:21:48
Oops, good point. Done.
| |
126 return; | |
127 #endif // USE_ASH | |
125 // We need to call SetShelfIDForWindow for V1 applications since they are | 128 // We need to call SetShelfIDForWindow for V1 applications since they are |
126 // content which might change and as such change the application type. | 129 // content which might change and as such change the application type. |
127 if (!browser || | 130 if (!browser || !launcher_controller()->IsBrowserFromActiveUser(browser) || |
128 !launcher_controller()->IsBrowserFromActiveUser(browser) || | |
129 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || | |
130 IsSettingsBrowser(browser)) | 131 IsSettingsBrowser(browser)) |
131 return; | 132 return; |
132 | 133 |
133 ash::SetShelfIDForWindow( | 134 ash::SetShelfIDForWindow( |
134 launcher_controller()->GetShelfIDForWebContents(web_contents), | 135 launcher_controller()->GetShelfIDForWebContents(web_contents), |
135 browser->window()->GetNativeWindow()); | 136 browser->window()->GetNativeWindow()); |
136 } | 137 } |
137 | 138 |
138 bool BrowserShortcutLauncherItemController::IsOpen() const { | 139 bool BrowserShortcutLauncherItemController::IsOpen() const { |
139 const BrowserList* browser_list = BrowserList::GetInstance(); | 140 const BrowserList* browser_list = BrowserList::GetInstance(); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 } | 340 } |
340 DCHECK(browser); | 341 DCHECK(browser); |
341 browser->window()->Show(); | 342 browser->window()->Show(); |
342 browser->window()->Activate(); | 343 browser->window()->Activate(); |
343 return kExistingWindowActivated; | 344 return kExistingWindowActivated; |
344 } | 345 } |
345 | 346 |
346 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( | 347 bool BrowserShortcutLauncherItemController::IsBrowserRepresentedInBrowserList( |
347 Browser* browser) { | 348 Browser* browser) { |
348 // Only Ash desktop browser windows for the active user are represented. | 349 // Only Ash desktop browser windows for the active user are represented. |
349 if (!browser || | 350 #if !defined(USE_ASH) |
350 !launcher_controller()->IsBrowserFromActiveUser(browser) || | 351 return; |
351 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) | 352 #endif |
353 if (!browser || !launcher_controller()->IsBrowserFromActiveUser(browser)) | |
352 return false; | 354 return false; |
353 | 355 |
354 // v1 App popup windows with a valid app id have their own icon. | 356 // v1 App popup windows with a valid app id have their own icon. |
355 if (browser->is_app() && | 357 if (browser->is_app() && |
356 browser->is_type_popup() && | 358 browser->is_type_popup() && |
357 launcher_controller()->GetShelfIDForAppID( | 359 launcher_controller()->GetShelfIDForAppID( |
358 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) | 360 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) |
359 return false; | 361 return false; |
360 | 362 |
361 // Settings browsers have their own icon. | 363 // Settings browsers have their own icon. |
362 if (IsSettingsBrowser(browser)) | 364 if (IsSettingsBrowser(browser)) |
363 return false; | 365 return false; |
364 | 366 |
365 // Tabbed browser and other popup windows are all represented. | 367 // Tabbed browser and other popup windows are all represented. |
366 return true; | 368 return true; |
367 } | 369 } |
OLD | NEW |