Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / chrome_app_sorting.cc
index c96ae09..5f05f47 100644 (file)
@@ -12,6 +12,7 @@
 #include "chrome/common/extensions/extension_constants.h"
 #include "content/public/browser/notification_service.h"
 #include "extensions/browser/extension_scoped_prefs.h"
+#include "extensions/common/constants.h"
 #include "extensions/common/extension.h"
 
 #if defined(OS_CHROMEOS)
@@ -218,7 +219,7 @@ void ChromeAppSorting::FixNTPOrdinalCollisions() {
   }
 
   content::NotificationService::current()->Notify(
-      chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED,
+      chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
       content::Source<ChromeAppSorting>(this),
       content::NotificationService::NoDetails());
 }
@@ -281,7 +282,7 @@ void ChromeAppSorting::OnExtensionMoved(
   SyncIfNeeded(moved_extension_id);
 
   content::NotificationService::current()->Notify(
-      chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED,
+      chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
       content::Source<ChromeAppSorting>(this),
       content::Details<const std::string>(&moved_extension_id));
 }
@@ -435,8 +436,12 @@ syncer::StringOrdinal ChromeAppSorting::PageIntegerAsStringOrdinal(
   return ntp_ordinal_map_.rbegin()->first;
 }
 
-void ChromeAppSorting::MarkExtensionAsHidden(const std::string& extension_id) {
-  ntp_hidden_extensions_.insert(extension_id);
+void ChromeAppSorting::SetExtensionVisible(const std::string& extension_id,
+                                           bool visible) {
+  if (visible)
+    ntp_hidden_extensions_.erase(extension_id);
+  else
+    ntp_hidden_extensions_.insert(extension_id);
 }
 
 syncer::StringOrdinal ChromeAppSorting::GetMinOrMaxAppLaunchOrdinalsOnPage(
@@ -473,17 +478,17 @@ void ChromeAppSorting::InitializePageOrdinalMap(
 
     // Ensure that the web store app still isn't found in this list, since
     // it is added after this loop.
-    DCHECK(*ext_it != extension_misc::kWebStoreAppId);
+    DCHECK(*ext_it != extensions::kWebStoreAppId);
     DCHECK(*ext_it != extension_misc::kChromeAppId);
   }
 
   // Include the Web Store App since it is displayed on the NTP.
   syncer::StringOrdinal web_store_app_page =
-      GetPageOrdinal(extension_misc::kWebStoreAppId);
+      GetPageOrdinal(extensions::kWebStoreAppId);
   if (web_store_app_page.IsValid()) {
-    AddOrdinalMapping(extension_misc::kWebStoreAppId,
+    AddOrdinalMapping(extensions::kWebStoreAppId,
                       web_store_app_page,
-                      GetAppLaunchOrdinal(extension_misc::kWebStoreAppId));
+                      GetAppLaunchOrdinal(extensions::kWebStoreAppId));
   }
   // Include the Chrome App since it is displayed in the app launcher.
   syncer::StringOrdinal chrome_app_page =
@@ -544,9 +549,9 @@ void ChromeAppSorting::CreateDefaultOrdinals() {
   std::vector<std::string> app_ids;
   chromeos::default_app_order::Get(&app_ids);
 #else
-  const char* kDefaultAppOrder[] = {
+  const char* const kDefaultAppOrder[] = {
     extension_misc::kChromeAppId,
-    extension_misc::kWebStoreAppId,
+    extensions::kWebStoreAppId,
   };
   const std::vector<const char*> app_ids(
       kDefaultAppOrder, kDefaultAppOrder + arraysize(kDefaultAppOrder));