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

Unified Diff: athena/env/athena_env_impl.cc

Issue 544953003: Supprot V2 app: step1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/content/web_activity.cc ('k') | athena/env/athena_env_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/env/athena_env_impl.cc
diff --git a/athena/env/athena_env_impl.cc b/athena/env/athena_env_impl.cc
index 130f8af0c859510379f696748403ddd84a71fd6f..bd299a230836818e6d513bb914d1ac59ebad7688 100644
--- a/athena/env/athena_env_impl.cc
+++ b/athena/env/athena_env_impl.cc
@@ -4,6 +4,8 @@
#include "athena/env/public/athena_env.h"
+#include <vector>
+
#include "athena/util/fill_layout_manager.h"
#include "base/sys_info.h"
#include "ui/aura/client/aura_constants.h"
@@ -249,13 +251,50 @@ class AthenaEnvImpl : public AthenaEnv,
}
private:
- virtual aura::WindowTreeHost* GetHost() OVERRIDE { return host_.get(); }
+ struct Finder {
+ explicit Finder(const base::Closure& c) : closure(c) {}
+ bool operator()(const base::Closure& other) {
+ return closure.Equals(other);
+ }
+ base::Closure closure;
+ };
// AthenaEnv:
+ virtual aura::WindowTreeHost* GetHost() OVERRIDE { return host_.get(); }
+
virtual void SetDisplayWorkAreaInsets(const gfx::Insets& insets) OVERRIDE {
screen_->SetWorkAreaInsets(insets);
}
+ virtual void AddTerminatingCallback(const base::Closure& closure) OVERRIDE {
+ if (closure.is_null())
+ return;
+ DCHECK(terminating_callbacks_.end() ==
+ std::find_if(terminating_callbacks_.begin(),
+ terminating_callbacks_.end(),
+ Finder(closure)));
+ terminating_callbacks_.push_back(closure);
+ }
+
+ virtual void RemoveTerminatingCallback(
+ const base::Closure& closure) OVERRIDE {
+ std::vector<base::Closure>::iterator iter =
+ std::find_if(terminating_callbacks_.begin(),
+ terminating_callbacks_.end(),
+ Finder(closure));
+ if (iter != terminating_callbacks_.end())
+ terminating_callbacks_.erase(iter);
+ }
+
+ virtual void OnTerminating() OVERRIDE {
+ for (std::vector<base::Closure>::iterator iter =
+ terminating_callbacks_.begin();
+ iter != terminating_callbacks_.end();
+ ++iter) {
+ iter->Run();
+ }
+ }
+
// ui::DisplayConfigurator::Observer:
virtual void OnDisplayModeChanged(const std::vector<
ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE {
@@ -290,6 +329,8 @@ class AthenaEnvImpl : public AthenaEnv,
scoped_ptr<ui::DisplayConfigurator> display_configurator_;
scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
+ std::vector<base::Closure> terminating_callbacks_;
+
DISALLOW_COPY_AND_ASSIGN(AthenaEnvImpl);
};
« no previous file with comments | « athena/content/web_activity.cc ('k') | athena/env/athena_env_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698