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

Side by Side Diff: chrome/browser/background/background_application_list_model.h

Issue 10298002: No longer start BG mode until a BackgroundContents is loaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prospective fix for cros test failures. Created 8 years, 7 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 | « no previous file | chrome/browser/background/background_application_list_model.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 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ 5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ 6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 17
18 class Profile; 18 class Profile;
19 19
20 // Model for list of Background Applications, that is, Extensions with 20 // Model for list of Background Applications associated with a Profile (i.e.
21 // kBackgroundPermission set, associated with a Profile. 21 // extensions with kBackgroundPermission set, or hosted apps with a
22 // BackgroundContents).
22 class BackgroundApplicationListModel : public content::NotificationObserver { 23 class BackgroundApplicationListModel : public content::NotificationObserver {
23 public: 24 public:
24 // Observer is informed of changes to the model. Users of the 25 // Observer is informed of changes to the model. Users of the
25 // BackgroundApplicationListModel should anticipate that associated data, 26 // BackgroundApplicationListModel should anticipate that associated data,
26 // e. g. the Icon, may exist and yet not be immediately available. When the 27 // e. g. the Icon, may exist and yet not be immediately available. When the
27 // data becomes available, OnApplicationDataChanged will be invoked for all 28 // data becomes available, OnApplicationDataChanged will be invoked for all
28 // Observers of the model. 29 // Observers of the model.
29 class Observer { 30 class Observer {
30 public: 31 public:
31 // Invoked when data that the model associates with the extension, such as 32 // Invoked when data that the model associates with the extension, such as
(...skipping 27 matching lines...) Expand all
59 // ExtensionIconSet::EXTENSION_ICON_BITTY. 60 // ExtensionIconSet::EXTENSION_ICON_BITTY.
60 const SkBitmap* GetIcon(const Extension* extension); 61 const SkBitmap* GetIcon(const Extension* extension);
61 62
62 // Return the position of |extension| within this list model. 63 // Return the position of |extension| within this list model.
63 int GetPosition(const Extension* extension) const; 64 int GetPosition(const Extension* extension) const;
64 65
65 // Return the extension at the specified |position| in this list model. 66 // Return the extension at the specified |position| in this list model.
66 const Extension* GetExtension(int position) const; 67 const Extension* GetExtension(int position) const;
67 68
68 // Returns true if the passed extension is a background app. 69 // Returns true if the passed extension is a background app.
69 static bool IsBackgroundApp(const Extension& extension); 70 static bool IsBackgroundApp(const Extension& extension,
71 Profile* profile);
70 72
71 // Dissociate observer from this model. 73 // Dissociate observer from this model.
72 void RemoveObserver(Observer* observer); 74 void RemoveObserver(Observer* observer);
73 75
74 ExtensionList::const_iterator begin() const { 76 ExtensionList::const_iterator begin() const {
75 return extensions_.begin(); 77 return extensions_.begin();
76 } 78 }
77 79
78 ExtensionList::const_iterator end() const { 80 ExtensionList::const_iterator end() const {
79 return extensions_.end(); 81 return extensions_.end();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 ApplicationMap applications_; 136 ApplicationMap applications_;
135 ExtensionList extensions_; 137 ExtensionList extensions_;
136 ObserverList<Observer> observers_; 138 ObserverList<Observer> observers_;
137 Profile* profile_; 139 Profile* profile_;
138 content::NotificationRegistrar registrar_; 140 content::NotificationRegistrar registrar_;
139 141
140 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationListModel); 142 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationListModel);
141 }; 143 };
142 144
143 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_ 145 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_APPLICATION_LIST_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/background/background_application_list_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698