| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/browser/ui/browser_commands.h" | 30 #include "chrome/browser/ui/browser_commands.h" |
| 31 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
| 32 #include "chrome/browser/ui/browser_list.h" | 32 #include "chrome/browser/ui/browser_list.h" |
| 33 #include "chrome/browser/ui/chrome_pages.h" | 33 #include "chrome/browser/ui/chrome_pages.h" |
| 34 #include "chrome/browser/ui/extensions/application_launch.h" | 34 #include "chrome/browser/ui/extensions/application_launch.h" |
| 35 #include "chrome/browser/ui/host_desktop.h" | 35 #include "chrome/browser/ui/host_desktop.h" |
| 36 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
| 37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/extensions/extension_constants.h" | 38 #include "chrome/common/extensions/extension_constants.h" |
| 39 #include "chrome/common/extensions/manifest_url_handler.h" | |
| 40 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/grit/chromium_strings.h" | 40 #include "chrome/grit/chromium_strings.h" |
| 42 #include "chrome/grit/generated_resources.h" | 41 #include "chrome/grit/generated_resources.h" |
| 43 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 44 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 45 #include "extensions/browser/extension_system.h" | 44 #include "extensions/browser/extension_system.h" |
| 46 #include "extensions/common/extension.h" | 45 #include "extensions/common/extension.h" |
| 46 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 47 #include "extensions/common/permissions/permission_set.h" | 47 #include "extensions/common/permissions/permission_set.h" |
| 48 #include "grit/chrome_unscaled_resources.h" | 48 #include "grit/chrome_unscaled_resources.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "ui/base/resource/resource_bundle.h" | 50 #include "ui/base/resource/resource_bundle.h" |
| 51 | 51 |
| 52 using base::UserMetricsAction; | 52 using base::UserMetricsAction; |
| 53 using extensions::Extension; | 53 using extensions::Extension; |
| 54 using extensions::UpdatedExtensionPermissionsInfo; | 54 using extensions::UpdatedExtensionPermissionsInfo; |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // will cause this menu item to go to the extensions page with an | 131 // will cause this menu item to go to the extensions page with an |
| 132 // absent component extension. | 132 // absent component extension. |
| 133 // | 133 // |
| 134 // Ideally, we would remove this item, but this conflicts with the user | 134 // Ideally, we would remove this item, but this conflicts with the user |
| 135 // model where this menu shows the extensions with background. | 135 // model where this menu shows the extensions with background. |
| 136 // | 136 // |
| 137 // The compromise is to disable the item, avoiding the non-actionable | 137 // The compromise is to disable the item, avoiding the non-actionable |
| 138 // navigate to the extensions page and preserving the user model. | 138 // navigate to the extensions page and preserving the user model. |
| 139 if ((*cursor)->location() == extensions::Manifest::COMPONENT) { | 139 if ((*cursor)->location() == extensions::Manifest::COMPONENT) { |
| 140 GURL options_page = | 140 GURL options_page = |
| 141 extensions::ManifestURL::GetOptionsPage(cursor->get()); | 141 extensions::OptionsPageInfo::GetOptionsPage(cursor->get()); |
| 142 if (!options_page.is_valid()) | 142 if (!options_page.is_valid()) |
| 143 menu->SetCommandIdEnabled(command_id, false); | 143 menu->SetCommandIdEnabled(command_id, false); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 if (containing_menu) { | 147 if (containing_menu) { |
| 148 int menu_command_id = command_id_extension_vector_->size(); | 148 int menu_command_id = command_id_extension_vector_->size(); |
| 149 // Check that the command ID is within the dynamic range. | 149 // Check that the command ID is within the dynamic range. |
| 150 DCHECK(menu_command_id < IDC_MinimumLabelValue); | 150 DCHECK(menu_command_id < IDC_MinimumLabelValue); |
| 151 command_id_extension_vector_->push_back(kInvalidExtensionIndex); | 151 command_id_extension_vector_->push_back(kInvalidExtensionIndex); |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 } | 800 } |
| 801 } | 801 } |
| 802 return profile_it; | 802 return profile_it; |
| 803 } | 803 } |
| 804 | 804 |
| 805 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 805 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 806 PrefService* service = g_browser_process->local_state(); | 806 PrefService* service = g_browser_process->local_state(); |
| 807 DCHECK(service); | 807 DCHECK(service); |
| 808 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 808 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 809 } | 809 } |
| OLD | NEW |