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

Side by Side Diff: ash/launcher/launcher_util.cc

Issue 12442009: Minor Ash panel related cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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
« no previous file with comments | « ash/launcher/launcher_util.h ('k') | ash/shell/launcher_delegate_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/launcher/launcher_util.h" 5 #include "ash/launcher/launcher_util.h"
6 6
7 #include "ash/launcher/launcher_model.h" 7 #include "ash/launcher/launcher_model.h"
8 #include "ash/launcher/launcher_types.h" 8 #include "ash/launcher/launcher_types.h"
9 #include "ash/shell.h"
10 #include "ui/aura/client/window_types.h"
11 #include "ui/aura/window.h"
12 #include "ui/views/view.h"
13 #include "ui/views/widget/widget.h"
14 9
15 namespace ash { 10 namespace ash {
16 namespace launcher { 11 namespace launcher {
17 12
18 int GetBrowserItemIndex(const LauncherModel& launcher_model) { 13 int GetBrowserItemIndex(const LauncherModel& launcher_model) {
19 for (size_t i = 0; i < launcher_model.items().size(); i++) { 14 for (size_t i = 0; i < launcher_model.items().size(); i++) {
20 if (launcher_model.items()[i].type == ash::TYPE_BROWSER_SHORTCUT) 15 if (launcher_model.items()[i].type == ash::TYPE_BROWSER_SHORTCUT)
21 return i; 16 return i;
22 } 17 }
23 return -1; 18 return -1;
24 } 19 }
25 20
26 void MoveToEventRootIfPanel(aura::Window* maybe_panel,
27 const ui::Event& event) {
28 if (maybe_panel->type() != aura::client::WINDOW_TYPE_PANEL)
29 return;
30 views::View* target = static_cast<views::View*>(event.target());
31 aura::RootWindow* target_root =
32 target ? target->GetWidget()->GetNativeView()->GetRootWindow() : NULL;
33 if (target_root && target_root != maybe_panel->GetRootWindow()) {
34 aura::Window* panel_container =
35 ash::Shell::GetContainer(target_root, maybe_panel->parent()->id());
36 // Move the panel to the target launcher.
37 panel_container->AddChild(maybe_panel);
38 }
39 }
40
41 } // namespace launcher 21 } // namespace launcher
42 } // namespace ash 22 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_util.h ('k') | ash/shell/launcher_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698