Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 2639463002: Add a pref name for share targets, and store their manifest data. (Closed)
Patch Set: Added tests. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profile.cc » ('j') | chrome/browser/profiles/profile.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
Matt Giuca 2017/01/23 03:04:12 Comment about the CL description: - The first lin
constantina 2017/01/24 02:03:42 Done.
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/extensions/bookmark_app_helper.h" 5 #include "chrome/browser/extensions/bookmark_app_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cctype> 9 #include <cctype>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/banners/app_banner_settings_helper.h" 16 #include "chrome/browser/banners/app_banner_settings_helper.h"
17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
18 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" 18 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/extensions/crx_installer.h" 20 #include "chrome/browser/extensions/crx_installer.h"
21 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
22 #include "chrome/browser/extensions/favicon_downloader.h" 22 #include "chrome/browser/extensions/favicon_downloader.h"
23 #include "chrome/browser/extensions/launch_util.h" 23 #include "chrome/browser/extensions/launch_util.h"
24 #include "chrome/browser/extensions/tab_helper.h" 24 #include "chrome/browser/extensions/tab_helper.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/app_list/app_list_service.h" 26 #include "chrome/browser/ui/app_list/app_list_service.h"
27 #include "chrome/browser/ui/app_list/app_list_util.h" 27 #include "chrome/browser/ui/app_list/app_list_util.h"
28 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/web_applications/web_app.h" 30 #include "chrome/browser/web_applications/web_app.h"
31 #include "chrome/browser/webshare/share_target_pref_helper.cc"
Matt Giuca 2017/01/23 03:00:57 You can't include a .cc file. Need a header file.
constantina 2017/01/24 02:03:42 Ah yeah, I just wanted to get it to work. Added he
31 #include "chrome/common/extensions/extension_constants.h" 32 #include "chrome/common/extensions/extension_constants.h"
32 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 33 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
34 #include "chrome/common/origin_trials/chrome_origin_trial_policy.h"
33 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
34 #include "chrome/grit/platform_locale_settings.h" 36 #include "chrome/grit/platform_locale_settings.h"
35 #include "components/prefs/pref_service.h" 37 #include "components/prefs/pref_service.h"
36 #include "content/public/browser/navigation_controller.h" 38 #include "content/public/browser/navigation_controller.h"
37 #include "content/public/browser/notification_service.h" 39 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/notification_source.h" 40 #include "content/public/browser/notification_source.h"
39 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
40 #include "extensions/browser/extension_registry.h" 42 #include "extensions/browser/extension_registry.h"
41 #include "extensions/browser/extension_system.h" 43 #include "extensions/browser/extension_system.h"
42 #include "extensions/browser/image_loader.h" 44 #include "extensions/browser/image_loader.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 OnDidGetManifest(GURL(), manifest); 578 OnDidGetManifest(GURL(), manifest);
577 } 579 }
578 580
579 void BookmarkAppHelper::OnDidGetManifest(const GURL& manifest_url, 581 void BookmarkAppHelper::OnDidGetManifest(const GURL& manifest_url,
580 const content::Manifest& manifest) { 582 const content::Manifest& manifest) {
581 if (contents_->IsBeingDestroyed()) 583 if (contents_->IsBeingDestroyed())
582 return; 584 return;
583 585
584 UpdateWebAppInfoFromManifest(manifest, &web_app_info_); 586 UpdateWebAppInfoFromManifest(manifest, &web_app_info_);
585 587
588 if (!ChromeOriginTrialPolicy().IsFeatureDisabled("WebShare")) {
589 AddShareTargetToPrefs(manifest_url.GetOrigin().spec(),
590 manifest.share_target.url_template,
mlamouri (slow - plz ping) 2017/01/23 00:24:06 Following up from my comment on the manifest's CL,
Matt Giuca 2017/01/23 03:00:57 Needs formatting (some alignment issue).
constantina 2017/01/24 02:03:42 Done.
constantina 2017/01/24 02:03:42 Done.
591 profile_->GetPrefs());
592 }
593
586 // Add urls from the WebApplicationInfo. 594 // Add urls from the WebApplicationInfo.
587 std::vector<GURL> web_app_info_icon_urls; 595 std::vector<GURL> web_app_info_icon_urls;
588 for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it = 596 for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it =
589 web_app_info_.icons.begin(); 597 web_app_info_.icons.begin();
590 it != web_app_info_.icons.end(); 598 it != web_app_info_.icons.end();
591 ++it) { 599 ++it) {
592 if (it->url.is_valid()) 600 if (it->url.is_valid())
593 web_app_info_icon_urls.push_back(it->url); 601 web_app_info_icon_urls.push_back(it->url);
594 } 602 }
595 603
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 816 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
809 } 817 }
810 818
811 bool IsValidBookmarkAppUrl(const GURL& url) { 819 bool IsValidBookmarkAppUrl(const GURL& url) {
812 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); 820 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes);
813 origin_only_pattern.SetMatchAllURLs(true); 821 origin_only_pattern.SetMatchAllURLs(true);
814 return url.is_valid() && origin_only_pattern.MatchesURL(url); 822 return url.is_valid() && origin_only_pattern.MatchesURL(url);
815 } 823 }
816 824
817 } // namespace extensions 825 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile.cc » ('j') | chrome/browser/profiles/profile.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698