Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "extensions/common/extension.h" | 5 #include "extensions/common/extension.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 bool Extension::ShouldDisplayInNewTabPage() const { | 350 bool Extension::ShouldDisplayInNewTabPage() const { |
| 351 // Only apps should be displayed on the NTP. | 351 // Only apps should be displayed on the NTP. |
| 352 return is_app() && display_in_new_tab_page_; | 352 return is_app() && display_in_new_tab_page_; |
| 353 } | 353 } |
| 354 | 354 |
| 355 bool Extension::ShouldDisplayInExtensionSettings() const { | 355 bool Extension::ShouldDisplayInExtensionSettings() const { |
| 356 // Don't show for themes since the settings UI isn't really useful for them. | 356 // Don't show for themes since the settings UI isn't really useful for them. |
| 357 if (is_theme()) | 357 if (is_theme()) |
| 358 return false; | 358 return false; |
| 359 | 359 |
| 360 // Don't show component extensions and invisible apps. | 360 // Hide component extensions because they are only extensions as an |
| 361 if (ShouldNotBeVisible()) | 361 // implementation detail of Chrome. |
| 362 if (extensions::Manifest::IsComponentLocation(location()) && | |
| 363 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 364 switches::kShowComponentExtensionOptions)) { | |
| 362 return false; | 365 return false; |
| 363 | 366 } |
| 364 // Always show unpacked extensions and apps. | |
| 365 if (Manifest::IsUnpackedLocation(location())) | |
| 366 return true; | |
| 367 | 367 |
| 368 // Unless they are unpacked, never show hosted apps. Note: We intentionally | 368 // Unless they are unpacked, never show hosted apps. Note: We intentionally |
| 369 // show packaged apps and platform apps because there are some pieces of | 369 // show packaged apps and platform apps because there are some pieces of |
| 370 // functionality that are only available in chrome://extensions/ but which | 370 // functionality that are only available in chrome://extensions/ but which |
| 371 // are needed for packaged and platform apps. For example, inspecting | 371 // are needed for packaged and platform apps. For example, inspecting |
| 372 // background pages. See http://crbug.com/116134. | 372 // background pages. See http://crbug.com/116134. |
| 373 if (is_hosted_app()) | 373 if (!Manifest::IsUnpackedLocation(location()) && is_hosted_app()) |
| 374 return false; | 374 return false; |
| 375 | 375 |
| 376 return true; | 376 return true; |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool Extension::ShouldNotBeVisible() const { | 379 bool Extension::ShouldExposeViaManagementAPI() const { |
| 380 // Don't show component extensions because they are only extensions as an | 380 // Hide component extensions because they are only extensions as an |
| 381 // implementation detail of Chrome. | 381 // implementation detail of Chrome. |
| 382 if (extensions::Manifest::IsComponentLocation(location()) && | 382 return !extensions::Manifest::IsComponentLocation(location()); |
|
lazyboy
2017/01/23 22:22:26
1) So management api won't see component extension
mtomasz
2017/01/26 08:38:30
Correct. --show-component-extensions-options refer
| |
| 383 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 384 switches::kShowComponentExtensionOptions)) { | |
| 385 return true; | |
| 386 } | |
| 387 | |
| 388 // Always show unpacked extensions and apps. | |
| 389 if (Manifest::IsUnpackedLocation(location())) | |
| 390 return false; | |
| 391 | |
| 392 // Don't show apps that aren't visible in either launcher or ntp. | |
| 393 if (is_app() && !ShouldDisplayInAppLauncher() && !ShouldDisplayInNewTabPage()) | |
|
lazyboy
2017/01/23 22:22:26
2) Apps that didn't specify to show themselves in
mtomasz
2017/01/26 08:38:30
Correct. I believe this was a bug. Hiding from lau
| |
| 394 return true; | |
| 395 | |
| 396 return false; | |
| 397 } | 383 } |
| 398 | 384 |
| 399 Extension::ManifestData* Extension::GetManifestData(const std::string& key) | 385 Extension::ManifestData* Extension::GetManifestData(const std::string& key) |
| 400 const { | 386 const { |
| 401 DCHECK(finished_parsing_manifest_ || thread_checker_.CalledOnValidThread()); | 387 DCHECK(finished_parsing_manifest_ || thread_checker_.CalledOnValidThread()); |
| 402 ManifestDataMap::const_iterator iter = manifest_data_.find(key); | 388 ManifestDataMap::const_iterator iter = manifest_data_.find(key); |
| 403 if (iter != manifest_data_.end()) | 389 if (iter != manifest_data_.end()) |
| 404 return iter->second.get(); | 390 return iter->second.get(); |
| 405 return NULL; | 391 return NULL; |
| 406 } | 392 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 : reason(reason), | 787 : reason(reason), |
| 802 extension(extension) {} | 788 extension(extension) {} |
| 803 | 789 |
| 804 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 790 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 805 const Extension* extension, | 791 const Extension* extension, |
| 806 const PermissionSet& permissions, | 792 const PermissionSet& permissions, |
| 807 Reason reason) | 793 Reason reason) |
| 808 : reason(reason), extension(extension), permissions(permissions) {} | 794 : reason(reason), extension(extension), permissions(permissions) {} |
| 809 | 795 |
| 810 } // namespace extensions | 796 } // namespace extensions |
| OLD | NEW |