Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc

Issue 12212207: Support panel titles and Icons for v1 apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shell_window_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/window_util.h" 8 #include "ash/wm/window_util.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
12 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h " 12 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h "
13 #include "chrome/browser/ui/extensions/shell_window.h" 13 #include "chrome/browser/ui/extensions/shell_window.h"
14 #include "ui/aura/client/activation_client.h" 14 #include "ui/aura/client/activation_client.h"
15 15
16 namespace { 16 namespace {
17 17
18 std::string GetAppLauncherId(ShellWindow* shell_window) { 18 std::string GetAppLauncherId(ShellWindow* shell_window) {
19 if (shell_window->window_type() == ShellWindow::WINDOW_TYPE_PANEL) 19 if (shell_window->window_type_is_panel())
20 return StringPrintf("panel:%d", shell_window->session_id().id()); 20 return StringPrintf("panel:%d", shell_window->session_id().id());
21 return shell_window->extension()->id(); 21 return shell_window->extension()->id();
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 ShellWindowLauncherController::ShellWindowLauncherController( 26 ShellWindowLauncherController::ShellWindowLauncherController(
27 ChromeLauncherController* owner) 27 ChromeLauncherController* owner)
28 : owner_(owner), 28 : owner_(owner),
29 registry_(extensions::ShellWindowRegistry::Get(owner->profile())), 29 registry_(extensions::ShellWindowRegistry::Get(owner->profile())),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ash::LauncherItemStatus status = ash::wm::IsActiveWindow(window) ? 68 ash::LauncherItemStatus status = ash::wm::IsActiveWindow(window) ?
69 ash::STATUS_ACTIVE : ash::STATUS_RUNNING; 69 ash::STATUS_ACTIVE : ash::STATUS_RUNNING;
70 AppControllerMap::iterator iter = app_controller_map_.find(app_launcher_id); 70 AppControllerMap::iterator iter = app_controller_map_.find(app_launcher_id);
71 ash::LauncherID launcher_id = 0; 71 ash::LauncherID launcher_id = 0;
72 if (iter != app_controller_map_.end()) { 72 if (iter != app_controller_map_.end()) {
73 ShellWindowLauncherItemController* controller = iter->second; 73 ShellWindowLauncherItemController* controller = iter->second;
74 DCHECK(controller->app_id() == app_id); 74 DCHECK(controller->app_id() == app_id);
75 launcher_id = controller->launcher_id(); 75 launcher_id = controller->launcher_id();
76 controller->AddShellWindow(shell_window, status); 76 controller->AddShellWindow(shell_window, status);
77 } else { 77 } else {
78 LauncherItemController::Type type = 78 LauncherItemController::Type type = shell_window->window_type_is_panel()
79 shell_window->window_type() == ShellWindow::WINDOW_TYPE_PANEL
80 ? LauncherItemController::TYPE_APP_PANEL 79 ? LauncherItemController::TYPE_APP_PANEL
81 : LauncherItemController::TYPE_APP; 80 : LauncherItemController::TYPE_APP;
82 ShellWindowLauncherItemController* controller = 81 ShellWindowLauncherItemController* controller =
83 new ShellWindowLauncherItemController( 82 new ShellWindowLauncherItemController(
84 type, app_launcher_id, app_id, owner_); 83 type, app_launcher_id, app_id, owner_);
85 controller->AddShellWindow(shell_window, status); 84 controller->AddShellWindow(shell_window, status);
86 // If the app launcher id is not unique, and there is already a launcher 85 // If the app launcher id is not unique, and there is already a launcher
87 // item for this app id (e.g. pinned), use that launcher item. 86 // item for this app id (e.g. pinned), use that launcher item.
88 if (app_launcher_id == app_id) 87 if (app_launcher_id == app_id)
89 launcher_id = owner_->GetLauncherIDForAppID(app_id); 88 launcher_id = owner_->GetLauncherIDForAppID(app_id);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 WindowToAppLauncherIdMap::iterator iter1 = 164 WindowToAppLauncherIdMap::iterator iter1 =
166 window_to_app_launcher_id_map_.find(window); 165 window_to_app_launcher_id_map_.find(window);
167 if (iter1 == window_to_app_launcher_id_map_.end()) 166 if (iter1 == window_to_app_launcher_id_map_.end())
168 return NULL; 167 return NULL;
169 std::string app_launcher_id = iter1->second; 168 std::string app_launcher_id = iter1->second;
170 AppControllerMap::iterator iter2 = app_controller_map_.find(app_launcher_id); 169 AppControllerMap::iterator iter2 = app_controller_map_.find(app_launcher_id);
171 if (iter2 == app_controller_map_.end()) 170 if (iter2 == app_controller_map_.end())
172 return NULL; 171 return NULL;
173 return iter2->second; 172 return iter2->second;
174 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698