| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_CONTENT_APP_ACTIVITY_REGISTRY_H_ | 5 #ifndef ATHENA_CONTENT_APP_ACTIVITY_REGISTRY_H_ |
| 6 #define ATHENA_CONTENT_APP_ACTIVITY_REGISTRY_H_ | 6 #define ATHENA_CONTENT_APP_ACTIVITY_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "athena/activity/public/activity_view_model.h" | 10 #include "athena/activity/public/activity_view_model.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Unload all application associated activities to save resources. | 51 // Unload all application associated activities to save resources. |
| 52 void Unload(); | 52 void Unload(); |
| 53 | 53 |
| 54 // Returns true if the application is in the unloaded state. | 54 // Returns true if the application is in the unloaded state. |
| 55 bool IsUnloaded() { return unloaded_activity_proxy_ != NULL; } | 55 bool IsUnloaded() { return unloaded_activity_proxy_ != NULL; } |
| 56 | 56 |
| 57 content::BrowserContext* browser_context() const { return browser_context_; } | 57 content::BrowserContext* browser_context() const { return browser_context_; } |
| 58 const std::string& app_id() const { return app_id_; } | 58 const std::string& app_id() const { return app_id_; } |
| 59 | 59 |
| 60 AppActivityProxy* unloaded_activity_proxy_for_test() { | 60 // Returns the proxy - if there is one. This will get used by a newly created |
| 61 return unloaded_activity_proxy_; | 61 // activity to position itself in its place before it get destroyed. |
| 62 } | 62 Activity* unloaded_activity_proxy() { return unloaded_activity_proxy_; } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 friend AppActivityProxy; | 65 friend AppActivityProxy; |
| 66 | 66 |
| 67 // When the |AppActivityProxy| gets destroyed it should call this function | 67 // When the |AppActivityProxy| gets destroyed it should call this function |
| 68 // to disconnect from this object. This call might destroy |this|. | 68 // to disconnect from this object. This call might destroy |this|. |
| 69 void ProxyDestroyed(AppActivityProxy* proxy); | 69 void ProxyDestroyed(AppActivityProxy* proxy); |
| 70 | 70 |
| 71 // When called by the |AppActivityProxy| to restart the application, it can | 71 // When called by the |AppActivityProxy| to restart the application, it can |
| 72 // cause the application to restart. When that happens the proxy will get | 72 // cause the application to restart. When that happens the proxy will get |
| 73 // destroyed. After this call |this| might be destroyed. | 73 // destroyed. After this call |this| might be destroyed. |
| 74 void RestartApplication(AppActivityProxy* proxy); | 74 void RestartApplication(AppActivityProxy* proxy); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // Move the window before the most recently used application window. | 77 // Get the most recently used activity. |
| 78 void MoveBeforeMruApplicationWindow(aura::Window* window); | 78 AppActivity* GetMruActivity(); |
| 79 | 79 |
| 80 // A list of all activities associated with this application. | 80 // A list of all activities associated with this application. |
| 81 std::vector<AppActivity*> activity_list_; | 81 std::vector<AppActivity*> activity_list_; |
| 82 | 82 |
| 83 // The application id for this proxy. | 83 // The application id for this proxy. |
| 84 std::string app_id_; | 84 std::string app_id_; |
| 85 | 85 |
| 86 // The browser context of the user. | 86 // The browser context of the user. |
| 87 content::BrowserContext* browser_context_; | 87 content::BrowserContext* browser_context_; |
| 88 | 88 |
| 89 // When the activity is unloaded this is the AppActivityProxy. The object is | 89 // When the activity is unloaded this is the AppActivityProxy. The object is |
| 90 // owned the the ActivityManager. | 90 // owned the the ActivityManager. |
| 91 AppActivityProxy* unloaded_activity_proxy_; | 91 AppActivityProxy* unloaded_activity_proxy_; |
| 92 | 92 |
| 93 // The presentation values. | 93 // The presentation values. |
| 94 SkColor color_; | 94 SkColor color_; |
| 95 base::string16 title_; | 95 base::string16 title_; |
| 96 gfx::ImageSkia image_; | 96 gfx::ImageSkia image_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(AppActivityRegistry); | 98 DISALLOW_COPY_AND_ASSIGN(AppActivityRegistry); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace athena | 101 } // namespace athena |
| 102 | 102 |
| 103 #endif // ATHENA_CONTENT_APP_ACTIVITY_REGISTRY_H_ | 103 #endif // ATHENA_CONTENT_APP_ACTIVITY_REGISTRY_H_ |
| OLD | NEW |