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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 const Extension* extension) { 328 const Extension* extension) {
329 if (!ShouldShow(extension)) 329 if (!ShouldShow(extension))
330 return; 330 return;
331 331
332 std::unique_ptr<base::DictionaryValue> app_info(GetAppInfo(extension)); 332 std::unique_ptr<base::DictionaryValue> app_info(GetAppInfo(extension));
333 if (!app_info.get()) 333 if (!app_info.get())
334 return; 334 return;
335 335
336 visible_apps_.insert(extension->id()); 336 visible_apps_.insert(extension->id());
337 ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile()); 337 ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile());
338 base::FundamentalValue highlight(prefs->IsFromBookmark(extension->id()) && 338 base::Value highlight(prefs->IsFromBookmark(extension->id()) &&
339 attempted_bookmark_app_install_); 339 attempted_bookmark_app_install_);
340 attempted_bookmark_app_install_ = false; 340 attempted_bookmark_app_install_ = false;
341 web_ui()->CallJavascriptFunctionUnsafe("ntp.appAdded", *app_info, highlight); 341 web_ui()->CallJavascriptFunctionUnsafe("ntp.appAdded", *app_info, highlight);
342 } 342 }
343 343
344 void AppLauncherHandler::OnExtensionUnloaded( 344 void AppLauncherHandler::OnExtensionUnloaded(
345 content::BrowserContext* browser_context, 345 content::BrowserContext* browser_context,
346 const Extension* extension, 346 const Extension* extension,
347 extensions::UnloadedExtensionInfo::Reason reason) { 347 extensions::UnloadedExtensionInfo::Reason reason) {
348 AppRemoved(extension, false); 348 AppRemoved(extension, false);
349 } 349 }
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 base::DictionaryValue dictionary; 790 base::DictionaryValue dictionary;
791 FillAppDictionary(&dictionary); 791 FillAppDictionary(&dictionary);
792 web_ui()->CallJavascriptFunctionUnsafe("ntp.appsPrefChangeCallback", 792 web_ui()->CallJavascriptFunctionUnsafe("ntp.appsPrefChangeCallback",
793 dictionary); 793 dictionary);
794 } 794 }
795 795
796 void AppLauncherHandler::OnLocalStatePreferenceChanged() { 796 void AppLauncherHandler::OnLocalStatePreferenceChanged() {
797 #if BUILDFLAG(ENABLE_APP_LIST) 797 #if BUILDFLAG(ENABLE_APP_LIST)
798 web_ui()->CallJavascriptFunctionUnsafe( 798 web_ui()->CallJavascriptFunctionUnsafe(
799 "ntp.appLauncherPromoPrefChangeCallback", 799 "ntp.appLauncherPromoPrefChangeCallback",
800 base::FundamentalValue(g_browser_process->local_state()->GetBoolean( 800 base::Value(g_browser_process->local_state()->GetBoolean(
801 prefs::kShowAppLauncherPromo))); 801 prefs::kShowAppLauncherPromo)));
802 #endif 802 #endif
803 } 803 }
804 804
805 void AppLauncherHandler::CleanupAfterUninstall() { 805 void AppLauncherHandler::CleanupAfterUninstall() {
806 extension_id_prompting_.clear(); 806 extension_id_prompting_.clear();
807 } 807 }
808 808
809 void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) { 809 void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) {
810 if (!extension_id_prompting_.empty()) 810 if (!extension_id_prompting_.empty())
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 void AppLauncherHandler::AppRemoved(const Extension* extension, 869 void AppLauncherHandler::AppRemoved(const Extension* extension,
870 bool is_uninstall) { 870 bool is_uninstall) {
871 if (!ShouldShow(extension)) 871 if (!ShouldShow(extension))
872 return; 872 return;
873 873
874 std::unique_ptr<base::DictionaryValue> app_info(GetAppInfo(extension)); 874 std::unique_ptr<base::DictionaryValue> app_info(GetAppInfo(extension));
875 if (!app_info.get()) 875 if (!app_info.get())
876 return; 876 return;
877 877
878 web_ui()->CallJavascriptFunctionUnsafe( 878 web_ui()->CallJavascriptFunctionUnsafe(
879 "ntp.appRemoved", *app_info, base::FundamentalValue(is_uninstall), 879 "ntp.appRemoved", *app_info, base::Value(is_uninstall),
880 base::FundamentalValue(!extension_id_prompting_.empty())); 880 base::Value(!extension_id_prompting_.empty()));
881 } 881 }
882 882
883 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { 883 bool AppLauncherHandler::ShouldShow(const Extension* extension) const {
884 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) 884 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app())
885 return false; 885 return false;
886 886
887 Profile* profile = Profile::FromWebUI(web_ui()); 887 Profile* profile = Profile::FromWebUI(web_ui());
888 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); 888 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile);
889 } 889 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698