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

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

Issue 11363250: Allow Chrome apps to create Ash Panels (apps v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Multi-icon support Created 8 years, 1 month 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
15 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 16 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
16 #include "chrome/browser/ui/extensions/shell_window.h" 17 #include "chrome/browser/ui/extensions/shell_window.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "ui/aura/client/activation_client.h" 19 #include "ui/aura/client/activation_client.h"
19 20
20 namespace { 21 namespace {
21 22
22 // Currently apps have a single launcher item, so the launcher id is the 23 // Currently apps have a single launcher item, so the launcher id is the
23 // same as the app id. In the future, this may not be true (e.g. for panels). 24 // same as the app id. In the future, this may not be true (e.g. for panels).
24 std::string GetAppLauncherId(ShellWindow* shell_window) { 25 std::string GetAppLauncherId(ShellWindow* shell_window) {
26 if (shell_window->window_type() == ShellWindow::WINDOW_TYPE_PANEL)
27 return base::IntToString(shell_window->session_id().id());
sky 2012/11/20 02:05:05 Do you know this id is never going to conflict wit
stevenjb 2012/11/20 21:20:58 This uses SessionID which is globally unique acros
sky 2012/11/20 22:15:51 Indeed. But the return value from this is used in
stevenjb 2012/11/20 22:29:10 Ahh. Apologies, excellent point. I'll put a prefix
25 return shell_window->extension()->id(); 28 return shell_window->extension()->id();
26 } 29 }
27 30
28 bool AppLauncherIdIsForApp(const std::string& app_launcher_id, 31 bool AppLauncherIdIsForApp(const std::string& app_launcher_id,
sky 2012/11/20 02:05:05 Nuke this since I don't believe its used.
stevenjb 2012/11/20 21:20:58 Done.
29 const std::string& app_id) { 32 const std::string& app_id) {
30 return app_launcher_id == app_id; 33 return app_launcher_id == app_id;
31 } 34 }
32 35
33 // Functor for std::find_if used in AppLauncherItemController. 36 // Functor for std::find_if used in AppLauncherItemController.
34 class ShellWindowHasWindow { 37 class ShellWindowHasWindow {
35 public: 38 public:
36 explicit ShellWindowHasWindow(aura::Window* window) : window_(window) { } 39 explicit ShellWindowHasWindow(aura::Window* window) : window_(window) { }
37 40
38 bool operator()(ShellWindow* shell_window) const { 41 bool operator()(ShellWindow* shell_window) const {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 WindowToAppLauncherIdMap::iterator iter1 = 307 WindowToAppLauncherIdMap::iterator iter1 =
305 window_to_app_launcher_id_map_.find(window); 308 window_to_app_launcher_id_map_.find(window);
306 if (iter1 == window_to_app_launcher_id_map_.end()) 309 if (iter1 == window_to_app_launcher_id_map_.end())
307 return NULL; 310 return NULL;
308 std::string app_launcher_id = iter1->second; 311 std::string app_launcher_id = iter1->second;
309 AppControllerMap::iterator iter2 = app_controller_map_.find(app_launcher_id); 312 AppControllerMap::iterator iter2 = app_controller_map_.find(app_launcher_id);
310 if (iter2 == app_controller_map_.end()) 313 if (iter2 == app_controller_map_.end())
311 return NULL; 314 return NULL;
312 return iter2->second; 315 return iter2->second;
313 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698