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

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

Issue 1161233005: Implement app banner info bars on desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stop-icon-overgeneration
Patch Set: Moving feature enabling to existing #ifs Created 5 years, 6 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 | « chrome/browser/extensions/bookmark_app_helper.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »
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.
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 <cctype> 7 #include <cctype>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 callback_ = callback; 484 callback_ = callback;
485 485
486 if (contents_) { 486 if (contents_) {
487 contents_->GetManifest(base::Bind(&BookmarkAppHelper::OnDidGetManifest, 487 contents_->GetManifest(base::Bind(&BookmarkAppHelper::OnDidGetManifest,
488 base::Unretained(this))); 488 base::Unretained(this)));
489 } else { 489 } else {
490 OnIconsDownloaded(true, std::map<GURL, std::vector<SkBitmap> >()); 490 OnIconsDownloaded(true, std::map<GURL, std::vector<SkBitmap> >());
491 } 491 }
492 } 492 }
493 493
494 void BookmarkAppHelper::CreateFromAppBanner(
495 const CreateBookmarkAppCallback& callback,
496 const content::Manifest& manifest) {
497 DCHECK(!manifest.short_name.is_null() || !manifest.name.is_null());
498 DCHECK(manifest.start_url.is_valid());
499
500 callback_ = callback;
501 OnDidGetManifest(manifest);
502 }
503
494 void BookmarkAppHelper::OnDidGetManifest(const content::Manifest& manifest) { 504 void BookmarkAppHelper::OnDidGetManifest(const content::Manifest& manifest) {
495 if (contents_->IsBeingDestroyed()) 505 if (contents_->IsBeingDestroyed())
496 return; 506 return;
497 507
498 UpdateWebAppInfoFromManifest(manifest, &web_app_info_); 508 UpdateWebAppInfoFromManifest(manifest, &web_app_info_);
499 509
500 // Add urls from the WebApplicationInfo. 510 // Add urls from the WebApplicationInfo.
501 std::vector<GURL> web_app_info_icon_urls; 511 std::vector<GURL> web_app_info_icon_urls;
502 for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it = 512 for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it =
503 web_app_info_.icons.begin(); 513 web_app_info_.icons.begin();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 730 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
721 } 731 }
722 732
723 bool IsValidBookmarkAppUrl(const GURL& url) { 733 bool IsValidBookmarkAppUrl(const GURL& url) {
724 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes); 734 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes);
725 origin_only_pattern.SetMatchAllURLs(true); 735 origin_only_pattern.SetMatchAllURLs(true);
726 return url.is_valid() && origin_only_pattern.MatchesURL(url); 736 return url.is_valid() && origin_only_pattern.MatchesURL(url);
727 } 737 }
728 738
729 } // namespace extensions 739 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698