| OLD | NEW |
| 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 <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile()); | 340 ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile()); |
| 341 base::Value highlight(prefs->IsFromBookmark(extension->id()) && | 341 base::Value highlight(prefs->IsFromBookmark(extension->id()) && |
| 342 attempted_bookmark_app_install_); | 342 attempted_bookmark_app_install_); |
| 343 attempted_bookmark_app_install_ = false; | 343 attempted_bookmark_app_install_ = false; |
| 344 web_ui()->CallJavascriptFunctionUnsafe("ntp.appAdded", *app_info, highlight); | 344 web_ui()->CallJavascriptFunctionUnsafe("ntp.appAdded", *app_info, highlight); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void AppLauncherHandler::OnExtensionUnloaded( | 347 void AppLauncherHandler::OnExtensionUnloaded( |
| 348 content::BrowserContext* browser_context, | 348 content::BrowserContext* browser_context, |
| 349 const Extension* extension, | 349 const Extension* extension, |
| 350 extensions::UnloadedExtensionInfo::Reason reason) { | 350 extensions::UnloadedExtensionReason reason) { |
| 351 AppRemoved(extension, false); | 351 AppRemoved(extension, false); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void AppLauncherHandler::OnExtensionUninstalled( | 354 void AppLauncherHandler::OnExtensionUninstalled( |
| 355 content::BrowserContext* browser_context, | 355 content::BrowserContext* browser_context, |
| 356 const Extension* extension, | 356 const Extension* extension, |
| 357 extensions::UninstallReason reason) { | 357 extensions::UninstallReason reason) { |
| 358 AppRemoved(extension, true); | 358 AppRemoved(extension, true); |
| 359 } | 359 } |
| 360 | 360 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 base::Value(!extension_id_prompting_.empty())); | 883 base::Value(!extension_id_prompting_.empty())); |
| 884 } | 884 } |
| 885 | 885 |
| 886 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { | 886 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { |
| 887 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) | 887 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) |
| 888 return false; | 888 return false; |
| 889 | 889 |
| 890 Profile* profile = Profile::FromWebUI(web_ui()); | 890 Profile* profile = Profile::FromWebUI(web_ui()); |
| 891 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); | 891 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); |
| 892 } | 892 } |
| OLD | NEW |