OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_launcher_controller_per_browser.
h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.
h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Check if there are any open tabs for this app. | 425 // Check if there are any open tabs for this app. |
426 AppIDToTabContentsListMap::iterator app_i = | 426 AppIDToTabContentsListMap::iterator app_i = |
427 app_id_to_tab_contents_list_.find(app_id); | 427 app_id_to_tab_contents_list_.find(app_id); |
428 if (app_i != app_id_to_tab_contents_list_.end()) { | 428 if (app_i != app_id_to_tab_contents_list_.end()) { |
429 for (TabContentsList::iterator tab_i = app_i->second.begin(); | 429 for (TabContentsList::iterator tab_i = app_i->second.begin(); |
430 tab_i != app_i->second.end(); | 430 tab_i != app_i->second.end(); |
431 ++tab_i) { | 431 ++tab_i) { |
432 TabContents* tab = *tab_i; | 432 TabContents* tab = *tab_i; |
433 const GURL tab_url = tab->web_contents()->GetURL(); | 433 const GURL tab_url = tab->web_contents()->GetURL(); |
434 if (refocus_pattern.MatchesURL(tab_url)) { | 434 if (refocus_pattern.MatchesURL(tab_url)) { |
435 Browser* browser = browser::FindBrowserWithWebContents( | 435 Browser* browser = chrome::FindBrowserWithWebContents( |
436 tab->web_contents()); | 436 tab->web_contents()); |
437 TabStripModel* tab_strip = browser->tab_strip_model(); | 437 TabStripModel* tab_strip = browser->tab_strip_model(); |
438 int index = tab_strip->GetIndexOfTabContents(tab); | 438 int index = tab_strip->GetIndexOfTabContents(tab); |
439 DCHECK_NE(TabStripModel::kNoTab, index); | 439 DCHECK_NE(TabStripModel::kNoTab, index); |
440 tab_strip->ActivateTabAt(index, false); | 440 tab_strip->ActivateTabAt(index, false); |
441 browser->window()->Show(); | 441 browser->window()->Show(); |
442 ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); | 442 ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); |
443 return; | 443 return; |
444 } | 444 } |
445 } | 445 } |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 id_to_item_controller_map_[id] = controller; | 1055 id_to_item_controller_map_[id] = controller; |
1056 controller->set_launcher_id(id); | 1056 controller->set_launcher_id(id); |
1057 | 1057 |
1058 ash::LauncherItem item; | 1058 ash::LauncherItem item; |
1059 item.type = controller->GetLauncherItemType(); | 1059 item.type = controller->GetLauncherItemType(); |
1060 item.is_incognito = false; | 1060 item.is_incognito = false; |
1061 item.image = Extension::GetDefaultIcon(true); | 1061 item.image = Extension::GetDefaultIcon(true); |
1062 | 1062 |
1063 TabContents* active_tab = GetLastActiveTabContents(app_id); | 1063 TabContents* active_tab = GetLastActiveTabContents(app_id); |
1064 if (active_tab) { | 1064 if (active_tab) { |
1065 Browser* browser = browser::FindBrowserWithWebContents( | 1065 Browser* browser = chrome::FindBrowserWithWebContents( |
1066 active_tab->web_contents()); | 1066 active_tab->web_contents()); |
1067 DCHECK(browser); | 1067 DCHECK(browser); |
1068 if (browser->window()->IsActive()) | 1068 if (browser->window()->IsActive()) |
1069 status = ash::STATUS_ACTIVE; | 1069 status = ash::STATUS_ACTIVE; |
1070 else | 1070 else |
1071 status = ash::STATUS_RUNNING; | 1071 status = ash::STATUS_RUNNING; |
1072 } | 1072 } |
1073 item.status = status; | 1073 item.status = status; |
1074 | 1074 |
1075 model_->AddAt(index, item); | 1075 model_->AddAt(index, item); |
(...skipping 30 matching lines...) Expand all Loading... |
1106 AppIconLoader* loader) { | 1106 AppIconLoader* loader) { |
1107 app_icon_loader_.reset(loader); | 1107 app_icon_loader_.reset(loader); |
1108 } | 1108 } |
1109 | 1109 |
1110 const std::string& | 1110 const std::string& |
1111 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( | 1111 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( |
1112 ash::LauncherID id) { | 1112 ash::LauncherID id) { |
1113 return id_to_item_controller_map_[id]->app_id(); | 1113 return id_to_item_controller_map_[id]->app_id(); |
1114 } | 1114 } |
1115 | 1115 |
OLD | NEW |