| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
| 36 #include "chrome/common/extensions/extension_constants.h" | 36 #include "chrome/common/extensions/extension_constants.h" |
| 37 #include "chrome/common/extensions/extension_icon_set.h" | 37 #include "chrome/common/extensions/extension_icon_set.h" |
| 38 #include "chrome/common/extensions/extension_resource.h" | 38 #include "chrome/common/extensions/extension_resource.h" |
| 39 #include "chrome/common/favicon_url.h" | 39 #include "chrome/common/favicon_url.h" |
| 40 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
| 42 #include "chrome/common/web_apps.h" | 42 #include "chrome/common/web_apps.h" |
| 43 #include "content/browser/disposition_utils.h" | 43 #include "content/browser/disposition_utils.h" |
| 44 #include "content/browser/tab_contents/tab_contents.h" | 44 #include "content/browser/tab_contents/tab_contents.h" |
| 45 #include "content/common/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
| 46 #include "googleurl/src/gurl.h" | 46 #include "googleurl/src/gurl.h" |
| 47 #include "grit/browser_resources.h" | 47 #include "grit/browser_resources.h" |
| 48 #include "grit/generated_resources.h" | 48 #include "grit/generated_resources.h" |
| 49 #include "net/base/escape.h" | 49 #include "net/base/escape.h" |
| 50 #include "ui/base/animation/animation.h" | 50 #include "ui/base/animation/animation.h" |
| 51 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
| 52 #include "ui/gfx/codec/png_codec.h" | 52 #include "ui/gfx/codec/png_codec.h" |
| 53 #include "webkit/glue/window_open_disposition.h" | 53 #include "webkit/glue/window_open_disposition.h" |
| 54 | 54 |
| 55 namespace { | 55 namespace { |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 535 |
| 536 // First time we get here we set up the observer so that we can tell update | 536 // First time we get here we set up the observer so that we can tell update |
| 537 // the apps as they change. | 537 // the apps as they change. |
| 538 if (!has_loaded_apps_) { | 538 if (!has_loaded_apps_) { |
| 539 pref_change_registrar_.Init( | 539 pref_change_registrar_.Init( |
| 540 extension_service_->extension_prefs()->pref_service()); | 540 extension_service_->extension_prefs()->pref_service()); |
| 541 pref_change_registrar_.Add(ExtensionPrefs::kExtensionsPref, this); | 541 pref_change_registrar_.Add(ExtensionPrefs::kExtensionsPref, this); |
| 542 pref_change_registrar_.Add(prefs::kNTPAppPageNames, this); | 542 pref_change_registrar_.Add(prefs::kNTPAppPageNames, this); |
| 543 | 543 |
| 544 registrar_.Add(this, chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, | 544 registrar_.Add(this, chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, |
| 545 NotificationService::AllSources()); | 545 content::NotificationService::AllSources()); |
| 546 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 546 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 547 content::Source<Profile>(profile)); | 547 content::Source<Profile>(profile)); |
| 548 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 548 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 549 content::Source<Profile>(profile)); | 549 content::Source<Profile>(profile)); |
| 550 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, | 550 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, |
| 551 content::Source<ExtensionPrefs>(extension_service_->extension_prefs())); | 551 content::Source<ExtensionPrefs>(extension_service_->extension_prefs())); |
| 552 registrar_.Add(this, chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, | 552 registrar_.Add(this, chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, |
| 553 content::Source<Profile>(profile)); | 553 content::Source<Profile>(profile)); |
| 554 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 554 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 555 content::Source<CrxInstaller>(NULL)); | 555 content::Source<CrxInstaller>(NULL)); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1035 |
| 1036 void AppLauncherHandler::UninstallDefaultApps() { | 1036 void AppLauncherHandler::UninstallDefaultApps() { |
| 1037 AppsPromo* apps_promo = extension_service_->apps_promo(); | 1037 AppsPromo* apps_promo = extension_service_->apps_promo(); |
| 1038 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 1038 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
| 1039 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 1039 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
| 1040 iter != app_ids.end(); ++iter) { | 1040 iter != app_ids.end(); ++iter) { |
| 1041 if (extension_service_->GetExtensionById(*iter, true)) | 1041 if (extension_service_->GetExtensionById(*iter, true)) |
| 1042 extension_service_->UninstallExtension(*iter, false, NULL); | 1042 extension_service_->UninstallExtension(*iter, false, NULL); |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| OLD | NEW |