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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
45 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
46 #include "chrome/common/web_application_info.h" | 46 #include "chrome/common/web_application_info.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/web_ui.h" | 48 #include "content/public/browser/web_ui.h" |
49 #include "content/public/common/favicon_url.h" | 49 #include "content/public/common/favicon_url.h" |
50 #include "extensions/browser/app_sorting.h" | 50 #include "extensions/browser/app_sorting.h" |
51 #include "extensions/browser/management_policy.h" | 51 #include "extensions/browser/management_policy.h" |
52 #include "extensions/common/constants.h" | 52 #include "extensions/common/constants.h" |
53 #include "extensions/common/extension.h" | 53 #include "extensions/common/extension.h" |
| 54 #include "extensions/common/extension_set.h" |
54 #include "grit/browser_resources.h" | 55 #include "grit/browser_resources.h" |
55 #include "grit/generated_resources.h" | 56 #include "grit/generated_resources.h" |
56 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
57 #include "ui/base/webui/web_ui_util.h" | 58 #include "ui/base/webui/web_ui_util.h" |
58 #include "ui/gfx/favicon_size.h" | 59 #include "ui/gfx/favicon_size.h" |
59 #include "url/gurl.h" | 60 #include "url/gurl.h" |
60 | 61 |
61 using content::WebContents; | 62 using content::WebContents; |
62 using extensions::AppSorting; | 63 using extensions::AppSorting; |
63 using extensions::CrxInstaller; | 64 using extensions::CrxInstaller; |
(...skipping 354 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 | 419 // 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 | 420 // like the set of apps installed has changed, and we will mark the promo |
420 // expired. | 421 // expired. |
421 // b) Conceptually, it doesn't really make sense to count a | 422 // b) Conceptually, it doesn't really make sense to count a |
422 // prefchange-triggered refresh as a promo 'view'. | 423 // prefchange-triggered refresh as a promo 'view'. |
423 Profile* profile = Profile::FromWebUI(web_ui()); | 424 Profile* profile = Profile::FromWebUI(web_ui()); |
424 | 425 |
425 // The first time we load the apps we must add all current app to the list | 426 // The first time we load the apps we must add all current app to the list |
426 // of apps visible on the NTP. | 427 // of apps visible on the NTP. |
427 if (!has_loaded_apps_) { | 428 if (!has_loaded_apps_) { |
428 const ExtensionSet* extensions = extension_service_->extensions(); | 429 const extensions::ExtensionSet* extensions = |
429 for (ExtensionSet::const_iterator it = extensions->begin(); | 430 extension_service_->extensions(); |
| 431 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
430 it != extensions->end(); ++it) { | 432 it != extensions->end(); ++it) { |
431 visible_apps_.insert((*it)->id()); | 433 visible_apps_.insert((*it)->id()); |
432 } | 434 } |
433 | 435 |
434 extensions = extension_service_->disabled_extensions(); | 436 extensions = extension_service_->disabled_extensions(); |
435 for (ExtensionSet::const_iterator it = extensions->begin(); | 437 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
436 it != extensions->end(); ++it) { | 438 it != extensions->end(); ++it) { |
437 visible_apps_.insert((*it)->id()); | 439 visible_apps_.insert((*it)->id()); |
438 } | 440 } |
439 | 441 |
440 extensions = extension_service_->terminated_extensions(); | 442 extensions = extension_service_->terminated_extensions(); |
441 for (ExtensionSet::const_iterator it = extensions->begin(); | 443 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
442 it != extensions->end(); ++it) { | 444 it != extensions->end(); ++it) { |
443 visible_apps_.insert((*it)->id()); | 445 visible_apps_.insert((*it)->id()); |
444 } | 446 } |
445 } | 447 } |
446 | 448 |
447 SetAppToBeHighlighted(); | 449 SetAppToBeHighlighted(); |
448 FillAppDictionary(&dictionary); | 450 FillAppDictionary(&dictionary); |
449 web_ui()->CallJavascriptFunction("ntp.getAppsCallback", dictionary); | 451 web_ui()->CallJavascriptFunction("ntp.getAppsCallback", dictionary); |
450 | 452 |
451 // First time we get here we set up the observer so that we can tell update | 453 // 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() { | 841 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
840 if (!extension_uninstall_dialog_.get()) { | 842 if (!extension_uninstall_dialog_.get()) { |
841 Browser* browser = chrome::FindBrowserWithWebContents( | 843 Browser* browser = chrome::FindBrowserWithWebContents( |
842 web_ui()->GetWebContents()); | 844 web_ui()->GetWebContents()); |
843 extension_uninstall_dialog_.reset( | 845 extension_uninstall_dialog_.reset( |
844 ExtensionUninstallDialog::Create(extension_service_->profile(), | 846 ExtensionUninstallDialog::Create(extension_service_->profile(), |
845 browser, this)); | 847 browser, this)); |
846 } | 848 } |
847 return extension_uninstall_dialog_.get(); | 849 return extension_uninstall_dialog_.get(); |
848 } | 850 } |
OLD | NEW |