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

Side by Side Diff: ui/aura_shell/launcher/launcher_model.cc

Issue 8289022: Wires keeping the launcher up to date with the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 9 years, 2 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 | « ui/aura_shell/launcher/launcher_model.h ('k') | ui/aura_shell/launcher/launcher_view.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura_shell/launcher/launcher_model.h" 5 #include "ui/aura_shell/launcher/launcher_model.h"
6 6
7 #include "ui/aura/window.h"
7 #include "ui/aura_shell/launcher/launcher_model_observer.h" 8 #include "ui/aura_shell/launcher/launcher_model_observer.h"
8 9
9 namespace aura_shell { 10 namespace aura_shell {
10 11
11 LauncherModel::LauncherModel() { 12 LauncherModel::LauncherModel() {
12 } 13 }
13 14
14 LauncherModel::~LauncherModel() { 15 LauncherModel::~LauncherModel() {
15 } 16 }
16 17
(...skipping 21 matching lines...) Expand all
38 } 39 }
39 40
40 void LauncherModel::SetAppImage(int index, const SkBitmap& image) { 41 void LauncherModel::SetAppImage(int index, const SkBitmap& image) {
41 DCHECK(index >= 0 && index < item_count()); 42 DCHECK(index >= 0 && index < item_count());
42 DCHECK_EQ(TYPE_APP, items_[index].type); 43 DCHECK_EQ(TYPE_APP, items_[index].type);
43 items_[index].app_image = image; 44 items_[index].app_image = image;
44 FOR_EACH_OBSERVER(LauncherModelObserver, observers_, 45 FOR_EACH_OBSERVER(LauncherModelObserver, observers_,
45 LauncherItemImagesChanged(index)); 46 LauncherItemImagesChanged(index));
46 } 47 }
47 48
49 int LauncherModel::ItemIndexByWindow(aura::Window* window) {
50 LauncherItems::const_iterator i = ItemByWindow(window);
51 return i == items_.end() ? -1 : static_cast<int>((i - items_.begin()));
52 }
53
54 LauncherItems::const_iterator LauncherModel::ItemByWindow(
55 aura::Window* window) const {
56 for (LauncherItems::const_iterator i = items_.begin();
57 i != items_.end(); ++i) {
58 if (i->window == window)
59 return i;
60 }
61 return items_.end();
62 }
63
48 void LauncherModel::AddObserver(LauncherModelObserver* observer) { 64 void LauncherModel::AddObserver(LauncherModelObserver* observer) {
49 observers_.AddObserver(observer); 65 observers_.AddObserver(observer);
50 } 66 }
51 67
52 void LauncherModel::RemoveObserver(LauncherModelObserver* observer) { 68 void LauncherModel::RemoveObserver(LauncherModelObserver* observer) {
53 observers_.RemoveObserver(observer); 69 observers_.RemoveObserver(observer);
54 } 70 }
55 71
56 } // namespace aura_shell 72 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/launcher/launcher_model.h ('k') | ui/aura_shell/launcher/launcher_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698