| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ |
| 6 #define CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "ui/gfx/image/image.h" |
| 15 | 16 |
| 16 class AvatarMenuModelObserver; | 17 class AvatarMenuModelObserver; |
| 17 class Browser; | 18 class Browser; |
| 18 class ProfileInfoInterface; | 19 class ProfileInfoInterface; |
| 19 | 20 |
| 20 namespace gfx { | |
| 21 class Image; | |
| 22 } | |
| 23 | |
| 24 // This class is the model for the menu-like interface that appears when the | 21 // This class is the model for the menu-like interface that appears when the |
| 25 // avatar icon is clicked in the browser window frame. This class will notify | 22 // avatar icon is clicked in the browser window frame. This class will notify |
| 26 // its observer when the backend data changes, and the controller/view for this | 23 // its observer when the backend data changes, and the controller/view for this |
| 27 // model should forward actions back to it in response to user events. | 24 // model should forward actions back to it in response to user events. |
| 28 class AvatarMenuModel : public content::NotificationObserver { | 25 class AvatarMenuModel : public content::NotificationObserver { |
| 29 public: | 26 public: |
| 30 // Represents an item in the menu. | 27 // Represents an item in the menu. |
| 31 struct Item { | 28 struct Item { |
| 32 Item(size_t model_index, const gfx::Image& icon); | 29 Item(size_t model_index, const gfx::Image& icon); |
| 33 ~Item(); | 30 ~Item(); |
| 34 | 31 |
| 35 // The icon to be displayed next to the item. | 32 // The icon to be displayed next to the item. |
| 36 const gfx::Image& icon; | 33 gfx::Image icon; |
| 37 | 34 |
| 38 // Whether or not the current browser is using this profile. | 35 // Whether or not the current browser is using this profile. |
| 39 bool active; | 36 bool active; |
| 40 | 37 |
| 41 // The name of this profile. | 38 // The name of this profile. |
| 42 string16 name; | 39 string16 name; |
| 43 | 40 |
| 44 // A string representing the sync state of the profile. | 41 // A string representing the sync state of the profile. |
| 45 string16 sync_state; | 42 string16 sync_state; |
| 46 | 43 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // List of built "menu items." | 103 // List of built "menu items." |
| 107 std::vector<Item*> items_; | 104 std::vector<Item*> items_; |
| 108 | 105 |
| 109 // Listens for notifications from the ProfileInfoCache. | 106 // Listens for notifications from the ProfileInfoCache. |
| 110 content::NotificationRegistrar registrar_; | 107 content::NotificationRegistrar registrar_; |
| 111 | 108 |
| 112 DISALLOW_COPY_AND_ASSIGN(AvatarMenuModel); | 109 DISALLOW_COPY_AND_ASSIGN(AvatarMenuModel); |
| 113 }; | 110 }; |
| 114 | 111 |
| 115 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ | 112 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_MODEL_H_ |
| OLD | NEW |