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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/common/favicon/favicon_types.h" | 43 #include "chrome/common/favicon/favicon_types.h" |
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/extension_registry.h" | 51 #include "extensions/browser/extension_registry.h" |
52 #include "extensions/browser/management_policy.h" | 52 #include "extensions/browser/management_policy.h" |
| 53 #include "extensions/browser/pref_names.h" |
53 #include "extensions/common/constants.h" | 54 #include "extensions/common/constants.h" |
54 #include "extensions/common/extension.h" | 55 #include "extensions/common/extension.h" |
55 #include "extensions/common/extension_set.h" | 56 #include "extensions/common/extension_set.h" |
56 #include "grit/browser_resources.h" | 57 #include "grit/browser_resources.h" |
57 #include "grit/generated_resources.h" | 58 #include "grit/generated_resources.h" |
58 #include "ui/base/l10n/l10n_util.h" | 59 #include "ui/base/l10n/l10n_util.h" |
59 #include "ui/base/webui/web_ui_util.h" | 60 #include "ui/base/webui/web_ui_util.h" |
60 #include "ui/gfx/favicon_size.h" | 61 #include "ui/gfx/favicon_size.h" |
61 #include "url/gurl.h" | 62 #include "url/gurl.h" |
62 | 63 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 web_ui()->CallJavascriptFunction("ntp.getAppsCallback", dictionary); | 458 web_ui()->CallJavascriptFunction("ntp.getAppsCallback", dictionary); |
458 | 459 |
459 // First time we get here we set up the observer so that we can tell update | 460 // First time we get here we set up the observer so that we can tell update |
460 // the apps as they change. | 461 // the apps as they change. |
461 if (!has_loaded_apps_) { | 462 if (!has_loaded_apps_) { |
462 base::Closure callback = base::Bind( | 463 base::Closure callback = base::Bind( |
463 &AppLauncherHandler::OnExtensionPreferenceChanged, | 464 &AppLauncherHandler::OnExtensionPreferenceChanged, |
464 base::Unretained(this)); | 465 base::Unretained(this)); |
465 extension_pref_change_registrar_.Init( | 466 extension_pref_change_registrar_.Init( |
466 extension_service_->extension_prefs()->pref_service()); | 467 extension_service_->extension_prefs()->pref_service()); |
467 extension_pref_change_registrar_.Add(prefs::kExtensionsPref, callback); | 468 extension_pref_change_registrar_.Add( |
| 469 extensions::pref_names::kExtensions, callback); |
468 extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); | 470 extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); |
469 | 471 |
470 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 472 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
471 content::Source<Profile>(profile)); | 473 content::Source<Profile>(profile)); |
472 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 474 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
473 content::Source<Profile>(profile)); | 475 content::Source<Profile>(profile)); |
474 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 476 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
475 content::Source<Profile>(profile)); | 477 content::Source<Profile>(profile)); |
476 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, | 478 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, |
477 content::Source<AppSorting>( | 479 content::Source<AppSorting>( |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 848 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
847 if (!extension_uninstall_dialog_.get()) { | 849 if (!extension_uninstall_dialog_.get()) { |
848 Browser* browser = chrome::FindBrowserWithWebContents( | 850 Browser* browser = chrome::FindBrowserWithWebContents( |
849 web_ui()->GetWebContents()); | 851 web_ui()->GetWebContents()); |
850 extension_uninstall_dialog_.reset( | 852 extension_uninstall_dialog_.reset( |
851 ExtensionUninstallDialog::Create(extension_service_->profile(), | 853 ExtensionUninstallDialog::Create(extension_service_->profile(), |
852 browser, this)); | 854 browser, this)); |
853 } | 855 } |
854 return extension_uninstall_dialog_.get(); | 856 return extension_uninstall_dialog_.get(); |
855 } | 857 } |
OLD | NEW |