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_app.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // Check if there are any open tabs for this app. | 422 // Check if there are any open tabs for this app. |
423 AppIDToTabContentsListMap::iterator app_i = | 423 AppIDToTabContentsListMap::iterator app_i = |
424 app_id_to_tab_contents_list_.find(app_id); | 424 app_id_to_tab_contents_list_.find(app_id); |
425 if (app_i != app_id_to_tab_contents_list_.end()) { | 425 if (app_i != app_id_to_tab_contents_list_.end()) { |
426 for (TabContentsList::iterator tab_i = app_i->second.begin(); | 426 for (TabContentsList::iterator tab_i = app_i->second.begin(); |
427 tab_i != app_i->second.end(); | 427 tab_i != app_i->second.end(); |
428 ++tab_i) { | 428 ++tab_i) { |
429 TabContents* tab = *tab_i; | 429 TabContents* tab = *tab_i; |
430 const GURL tab_url = tab->web_contents()->GetURL(); | 430 const GURL tab_url = tab->web_contents()->GetURL(); |
431 if (refocus_pattern.MatchesURL(tab_url)) { | 431 if (refocus_pattern.MatchesURL(tab_url)) { |
432 Browser* browser = browser::FindBrowserWithWebContents( | 432 Browser* browser = chrome::FindBrowserWithWebContents( |
433 tab->web_contents()); | 433 tab->web_contents()); |
434 TabStripModel* tab_strip = browser->tab_strip_model(); | 434 TabStripModel* tab_strip = browser->tab_strip_model(); |
435 int index = tab_strip->GetIndexOfTabContents(tab); | 435 int index = tab_strip->GetIndexOfTabContents(tab); |
436 DCHECK_NE(TabStripModel::kNoTab, index); | 436 DCHECK_NE(TabStripModel::kNoTab, index); |
437 tab_strip->ActivateTabAt(index, false); | 437 tab_strip->ActivateTabAt(index, false); |
438 browser->window()->Show(); | 438 browser->window()->Show(); |
439 ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); | 439 ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); |
440 return; | 440 return; |
441 } | 441 } |
442 } | 442 } |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 id_to_item_controller_map_[id] = controller; | 1049 id_to_item_controller_map_[id] = controller; |
1050 controller->set_launcher_id(id); | 1050 controller->set_launcher_id(id); |
1051 | 1051 |
1052 ash::LauncherItem item; | 1052 ash::LauncherItem item; |
1053 item.type = controller->GetLauncherItemType(); | 1053 item.type = controller->GetLauncherItemType(); |
1054 item.is_incognito = false; | 1054 item.is_incognito = false; |
1055 item.image = Extension::GetDefaultIcon(true); | 1055 item.image = Extension::GetDefaultIcon(true); |
1056 | 1056 |
1057 TabContents* active_tab = GetLastActiveTabContents(app_id); | 1057 TabContents* active_tab = GetLastActiveTabContents(app_id); |
1058 if (active_tab) { | 1058 if (active_tab) { |
1059 Browser* browser = browser::FindBrowserWithWebContents( | 1059 Browser* browser = chrome::FindBrowserWithWebContents( |
1060 active_tab->web_contents()); | 1060 active_tab->web_contents()); |
1061 DCHECK(browser); | 1061 DCHECK(browser); |
1062 if (browser->window()->IsActive()) | 1062 if (browser->window()->IsActive()) |
1063 status = ash::STATUS_ACTIVE; | 1063 status = ash::STATUS_ACTIVE; |
1064 else | 1064 else |
1065 status = ash::STATUS_RUNNING; | 1065 status = ash::STATUS_RUNNING; |
1066 } | 1066 } |
1067 item.status = status; | 1067 item.status = status; |
1068 | 1068 |
1069 model_->AddAt(index, item); | 1069 model_->AddAt(index, item); |
(...skipping 28 matching lines...) Expand all Loading... |
1098 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( | 1098 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( |
1099 AppIconLoader* loader) { | 1099 AppIconLoader* loader) { |
1100 app_icon_loader_.reset(loader); | 1100 app_icon_loader_.reset(loader); |
1101 } | 1101 } |
1102 | 1102 |
1103 const std::string& | 1103 const std::string& |
1104 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( | 1104 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( |
1105 ash::LauncherID id) { | 1105 ash::LauncherID id) { |
1106 return id_to_item_controller_map_[id]->app_id(); | 1106 return id_to_item_controller_map_[id]->app_id(); |
1107 } | 1107 } |
OLD | NEW |