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

Unified Diff: apps/app_shim/app_shim_handler_mac.cc

Issue 15269003: Refactor extension handling code from AppShimHost into ExtensionAppShimHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change to map of Hosts (no ObserverList). Improve test. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: apps/app_shim/app_shim_handler_mac.cc
diff --git a/apps/app_shim/app_shim_handler_mac.cc b/apps/app_shim/app_shim_handler_mac.cc
index 18cca9242674fbf4a19bb1d1d65e7704234e3bfe..6076557710a7a1e7644139931643bfd52ffaab81 100644
--- a/apps/app_shim/app_shim_handler_mac.cc
+++ b/apps/app_shim/app_shim_handler_mac.cc
@@ -25,7 +25,7 @@ class AppShimHandlerRegistry {
if (it != handlers_.end())
return it->second;
- return NULL;
+ return default_handler_;
}
bool SetForAppMode(const std::string& app_mode_id, AppShimHandler* handler) {
@@ -36,14 +36,20 @@ class AppShimHandlerRegistry {
return inserted_or_removed;
}
+ void SetDefaultHandler(AppShimHandler* handler) {
+ DCHECK_NE(default_handler_ == NULL, handler == NULL);
+ default_handler_ = handler;
+ }
+
private:
friend struct DefaultSingletonTraits<AppShimHandlerRegistry>;
typedef std::map<std::string, AppShimHandler*> HandlerMap;
- AppShimHandlerRegistry() {}
+ AppShimHandlerRegistry() : default_handler_(NULL) {}
~AppShimHandlerRegistry() {}
HandlerMap handlers_;
+ AppShimHandler* default_handler_;
DISALLOW_COPY_AND_ASSIGN(AppShimHandlerRegistry);
};
@@ -67,4 +73,9 @@ AppShimHandler* AppShimHandler::GetForAppMode(const std::string& app_mode_id) {
return AppShimHandlerRegistry::GetInstance()->GetForAppMode(app_mode_id);
}
+// static
+void AppShimHandler::SetDefaultHandler(AppShimHandler* handler) {
+ AppShimHandlerRegistry::GetInstance()->SetDefaultHandler(handler);
+}
+
} // namespace apps

Powered by Google App Engine
This is Rietveld 408576698