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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 if (browser_status != browser_item.status) { | 97 if (browser_status != browser_item.status) { |
98 browser_item.status = browser_status; | 98 browser_item.status = browser_status; |
99 model->Set(browser_index, browser_item); | 99 model->Set(browser_index, browser_item); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( | 103 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( |
104 Browser* browser, | 104 Browser* browser, |
105 content::WebContents* web_contents) { | 105 content::WebContents* web_contents) { |
106 if (!IsBrowserRepresentedInBrowserList(browser)) | 106 // We need to call SetShelfIDForWindow for V1 applications since they are |
| 107 // content which might change and as such change the application type. |
| 108 if (!browser || |
| 109 !launcher_controller()->IsBrowserFromActiveUser(browser) || |
| 110 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || |
| 111 chrome::IsTrustedPopupWindowWithScheme(browser, content::kChromeUIScheme)) |
107 return; | 112 return; |
| 113 |
108 ash::SetShelfIDForWindow( | 114 ash::SetShelfIDForWindow( |
109 launcher_controller()->GetShelfIDForWebContents(web_contents), | 115 launcher_controller()->GetShelfIDForWebContents(web_contents), |
110 browser->window()->GetNativeWindow()); | 116 browser->window()->GetNativeWindow()); |
111 } | 117 } |
112 | 118 |
113 bool BrowserShortcutLauncherItemController::IsOpen() const { | 119 bool BrowserShortcutLauncherItemController::IsOpen() const { |
114 const BrowserList* ash_browser_list = | 120 const BrowserList* ash_browser_list = |
115 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 121 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
116 for (BrowserList::const_iterator it = ash_browser_list->begin(); | 122 for (BrowserList::const_iterator it = ash_browser_list->begin(); |
117 it != ash_browser_list->end(); ++it) { | 123 it != ash_browser_list->end(); ++it) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) | 348 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) |
343 return false; | 349 return false; |
344 | 350 |
345 // Stand-alone chrome:// windows (e.g. settings) have their own icon. | 351 // Stand-alone chrome:// windows (e.g. settings) have their own icon. |
346 if (chrome::IsTrustedPopupWindowWithScheme(browser, content::kChromeUIScheme)) | 352 if (chrome::IsTrustedPopupWindowWithScheme(browser, content::kChromeUIScheme)) |
347 return false; | 353 return false; |
348 | 354 |
349 // Tabbed browser and other popup windows are all represented. | 355 // Tabbed browser and other popup windows are all represented. |
350 return true; | 356 return true; |
351 } | 357 } |
OLD | NEW |