| 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/common/shelf/shelf_delegate.h" | 10 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/shelf/shelf_model.h" | 11 #include "ash/common/shelf/shelf_model.h" |
| 11 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 13 #include "ash/common/wm_window_property.h" |
| 12 #include "ash/resources/grit/ash_resources.h" | 14 #include "ash/resources/grit/ash_resources.h" |
| 13 #include "ash/shelf/shelf_util.h" | |
| 14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
| 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h
" | 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h
" |
| 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" |
| 19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 21 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 22 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 22 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 23 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 23 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 111 |
| 111 if (browser_status != browser_item.status) { | 112 if (browser_status != browser_item.status) { |
| 112 browser_item.status = browser_status; | 113 browser_item.status = browser_status; |
| 113 shelf_model_->Set(browser_index, browser_item); | 114 shelf_model_->Set(browser_index, browser_item); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( | 118 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( |
| 118 Browser* browser, | 119 Browser* browser, |
| 119 content::WebContents* web_contents) { | 120 content::WebContents* web_contents) { |
| 120 // We need to call SetShelfIDForWindow for V1 applications since they are | 121 // We need to set the window ShelfID for V1 applications since they are |
| 121 // content which might change and as such change the application type. | 122 // content which might change and as such change the application type. |
| 122 if (!browser || !IsBrowserFromActiveUser(browser) || | 123 if (!browser || !IsBrowserFromActiveUser(browser) || |
| 123 IsSettingsBrowser(browser)) | 124 IsSettingsBrowser(browser)) |
| 124 return; | 125 return; |
| 125 | 126 |
| 126 ash::SetShelfIDForWindow( | 127 ash::WmWindowAura::Get(browser->window()->GetNativeWindow()) |
| 127 launcher_controller()->GetShelfIDForWebContents(web_contents), | 128 ->SetIntProperty( |
| 128 browser->window()->GetNativeWindow()); | 129 ash::WmWindowProperty::SHELF_ID, |
| 130 launcher_controller()->GetShelfIDForWebContents(web_contents)); |
| 129 } | 131 } |
| 130 | 132 |
| 131 bool BrowserShortcutLauncherItemController::IsOpen() const { | 133 bool BrowserShortcutLauncherItemController::IsOpen() const { |
| 132 const BrowserList* browser_list = BrowserList::GetInstance(); | 134 const BrowserList* browser_list = BrowserList::GetInstance(); |
| 133 for (BrowserList::const_iterator it = browser_list->begin(); | 135 for (BrowserList::const_iterator it = browser_list->begin(); |
| 134 it != browser_list->end(); ++it) { | 136 it != browser_list->end(); ++it) { |
| 135 if (IsBrowserFromActiveUser(*it)) | 137 if (IsBrowserFromActiveUser(*it)) |
| 136 return true; | 138 return true; |
| 137 } | 139 } |
| 138 return false; | 140 return false; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 !browser->window()->IsMinimized()) { | 361 !browser->window()->IsMinimized()) { |
| 360 continue; | 362 continue; |
| 361 } | 363 } |
| 362 if (!IsBrowserRepresentedInBrowserList(browser) && | 364 if (!IsBrowserRepresentedInBrowserList(browser) && |
| 363 !browser->is_type_tabbed()) | 365 !browser->is_type_tabbed()) |
| 364 continue; | 366 continue; |
| 365 active_browsers.push_back(browser); | 367 active_browsers.push_back(browser); |
| 366 } | 368 } |
| 367 return active_browsers; | 369 return active_browsers; |
| 368 } | 370 } |
| OLD | NEW |