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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "apps/metrics_names.h" | 9 #include "apps/metrics_names.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 // a) At that point in time, depending on the pref that changed, it can look | 418 // a) At that point in time, depending on the pref that changed, it can look |
419 // like the set of apps installed has changed, and we will mark the promo | 419 // like the set of apps installed has changed, and we will mark the promo |
420 // expired. | 420 // expired. |
421 // b) Conceptually, it doesn't really make sense to count a | 421 // b) Conceptually, it doesn't really make sense to count a |
422 // prefchange-triggered refresh as a promo 'view'. | 422 // prefchange-triggered refresh as a promo 'view'. |
423 Profile* profile = Profile::FromWebUI(web_ui()); | 423 Profile* profile = Profile::FromWebUI(web_ui()); |
424 | 424 |
425 // The first time we load the apps we must add all current app to the list | 425 // The first time we load the apps we must add all current app to the list |
426 // of apps visible on the NTP. | 426 // of apps visible on the NTP. |
427 if (!has_loaded_apps_) { | 427 if (!has_loaded_apps_) { |
428 const ExtensionSet* extensions = extension_service_->extensions(); | 428 const extensions::ExtensionSet* extensions = |
429 for (ExtensionSet::const_iterator it = extensions->begin(); | 429 extension_service_->extensions(); |
| 430 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
430 it != extensions->end(); ++it) { | 431 it != extensions->end(); ++it) { |
431 visible_apps_.insert((*it)->id()); | 432 visible_apps_.insert((*it)->id()); |
432 } | 433 } |
433 | 434 |
434 extensions = extension_service_->disabled_extensions(); | 435 extensions = extension_service_->disabled_extensions(); |
435 for (ExtensionSet::const_iterator it = extensions->begin(); | 436 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
436 it != extensions->end(); ++it) { | 437 it != extensions->end(); ++it) { |
437 visible_apps_.insert((*it)->id()); | 438 visible_apps_.insert((*it)->id()); |
438 } | 439 } |
439 | 440 |
440 extensions = extension_service_->terminated_extensions(); | 441 extensions = extension_service_->terminated_extensions(); |
441 for (ExtensionSet::const_iterator it = extensions->begin(); | 442 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
442 it != extensions->end(); ++it) { | 443 it != extensions->end(); ++it) { |
443 visible_apps_.insert((*it)->id()); | 444 visible_apps_.insert((*it)->id()); |
444 } | 445 } |
445 } | 446 } |
446 | 447 |
447 SetAppToBeHighlighted(); | 448 SetAppToBeHighlighted(); |
448 FillAppDictionary(&dictionary); | 449 FillAppDictionary(&dictionary); |
449 web_ui()->CallJavascriptFunction("ntp.getAppsCallback", dictionary); | 450 web_ui()->CallJavascriptFunction("ntp.getAppsCallback", dictionary); |
450 | 451 |
451 // First time we get here we set up the observer so that we can tell update | 452 // First time we get here we set up the observer so that we can tell update |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 840 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
840 if (!extension_uninstall_dialog_.get()) { | 841 if (!extension_uninstall_dialog_.get()) { |
841 Browser* browser = chrome::FindBrowserWithWebContents( | 842 Browser* browser = chrome::FindBrowserWithWebContents( |
842 web_ui()->GetWebContents()); | 843 web_ui()->GetWebContents()); |
843 extension_uninstall_dialog_.reset( | 844 extension_uninstall_dialog_.reset( |
844 ExtensionUninstallDialog::Create(extension_service_->profile(), | 845 ExtensionUninstallDialog::Create(extension_service_->profile(), |
845 browser, this)); | 846 browser, this)); |
846 } | 847 } |
847 return extension_uninstall_dialog_.get(); | 848 return extension_uninstall_dialog_.get(); |
848 } | 849 } |
OLD | NEW |