| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cctype> | 9 #include <cctype> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } | 564 } |
| 565 } | 565 } |
| 566 | 566 |
| 567 void BookmarkAppHelper::CreateFromAppBanner( | 567 void BookmarkAppHelper::CreateFromAppBanner( |
| 568 const CreateBookmarkAppCallback& callback, | 568 const CreateBookmarkAppCallback& callback, |
| 569 const content::Manifest& manifest) { | 569 const content::Manifest& manifest) { |
| 570 DCHECK(!manifest.short_name.is_null() || !manifest.name.is_null()); | 570 DCHECK(!manifest.short_name.is_null() || !manifest.name.is_null()); |
| 571 DCHECK(manifest.start_url.is_valid()); | 571 DCHECK(manifest.start_url.is_valid()); |
| 572 | 572 |
| 573 callback_ = callback; | 573 callback_ = callback; |
| 574 OnDidGetManifest(manifest); | 574 OnDidGetManifest(GURL(), manifest); |
| 575 } | 575 } |
| 576 | 576 |
| 577 void BookmarkAppHelper::OnDidGetManifest(const content::Manifest& manifest) { | 577 void BookmarkAppHelper::OnDidGetManifest(const GURL& manifest_url, |
| 578 const content::Manifest& manifest) { |
| 578 if (contents_->IsBeingDestroyed()) | 579 if (contents_->IsBeingDestroyed()) |
| 579 return; | 580 return; |
| 580 | 581 |
| 581 UpdateWebAppInfoFromManifest(manifest, &web_app_info_); | 582 UpdateWebAppInfoFromManifest(manifest, &web_app_info_); |
| 582 | 583 |
| 583 // Add urls from the WebApplicationInfo. | 584 // Add urls from the WebApplicationInfo. |
| 584 std::vector<GURL> web_app_info_icon_urls; | 585 std::vector<GURL> web_app_info_icon_urls; |
| 585 for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it = | 586 for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it = |
| 586 web_app_info_.icons.begin(); | 587 web_app_info_.icons.begin(); |
| 587 it != web_app_info_.icons.end(); | 588 it != web_app_info_.icons.end(); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); | 797 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); |
| 797 } | 798 } |
| 798 | 799 |
| 799 bool IsValidBookmarkAppUrl(const GURL& url) { | 800 bool IsValidBookmarkAppUrl(const GURL& url) { |
| 800 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); | 801 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); |
| 801 origin_only_pattern.SetMatchAllURLs(true); | 802 origin_only_pattern.SetMatchAllURLs(true); |
| 802 return url.is_valid() && origin_only_pattern.MatchesURL(url); | 803 return url.is_valid() && origin_only_pattern.MatchesURL(url); |
| 803 } | 804 } |
| 804 | 805 |
| 805 } // namespace extensions | 806 } // namespace extensions |
| OLD | NEW |