| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/banners/app_banner_data_fetcher.h" | 5 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "chrome/browser/banners/app_banner_metrics.h" | 9 #include "chrome/browser/banners/app_banner_metrics.h" |
| 10 #include "chrome/browser/banners/app_banner_settings_helper.h" | 10 #include "chrome/browser/banners/app_banner_settings_helper.h" |
| 11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
| 14 #include "chrome/browser/manifest/manifest_icon_selector.h" | 14 #include "chrome/browser/manifest/manifest_icon_selector.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
| 17 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
| 18 #include "components/rappor/rappor_utils.h" | 18 #include "components/rappor/rappor_utils.h" |
| 19 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/navigation_details.h" |
| 21 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
| 22 #include "content/public/browser/service_worker_context.h" | 23 #include "content/public/browser/service_worker_context.h" |
| 23 #include "content/public/browser/storage_partition.h" | 24 #include "content/public/browser/storage_partition.h" |
| 24 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
| 25 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" | 26 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" |
| 26 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 base::TimeDelta gTimeDeltaForTesting; | 31 base::TimeDelta gTimeDeltaForTesting; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 108 } |
| 108 | 109 |
| 109 void AppBannerDataFetcher::WebContentsDestroyed() { | 110 void AppBannerDataFetcher::WebContentsDestroyed() { |
| 110 Cancel(); | 111 Cancel(); |
| 111 Observe(nullptr); | 112 Observe(nullptr); |
| 112 } | 113 } |
| 113 | 114 |
| 114 void AppBannerDataFetcher::DidNavigateMainFrame( | 115 void AppBannerDataFetcher::DidNavigateMainFrame( |
| 115 const content::LoadCommittedDetails& details, | 116 const content::LoadCommittedDetails& details, |
| 116 const content::FrameNavigateParams& params) { | 117 const content::FrameNavigateParams& params) { |
| 117 Cancel(); | 118 if (!details.is_in_page) |
| 119 Cancel(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 bool AppBannerDataFetcher::OnMessageReceived( | 122 bool AppBannerDataFetcher::OnMessageReceived( |
| 121 const IPC::Message& message, content::RenderFrameHost* render_frame_host) { | 123 const IPC::Message& message, content::RenderFrameHost* render_frame_host) { |
| 122 bool handled = true; | 124 bool handled = true; |
| 123 | 125 |
| 124 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(AppBannerDataFetcher, message, | 126 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(AppBannerDataFetcher, message, |
| 125 render_frame_host) | 127 render_frame_host) |
| 126 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AppBannerPromptReply, | 128 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AppBannerPromptReply, |
| 127 OnBannerPromptReply) | 129 OnBannerPromptReply) |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (!manifest.start_url.is_valid()) | 343 if (!manifest.start_url.is_valid()) |
| 342 return false; | 344 return false; |
| 343 if (manifest.name.is_null() && manifest.short_name.is_null()) | 345 if (manifest.name.is_null() && manifest.short_name.is_null()) |
| 344 return false; | 346 return false; |
| 345 if (!DoesManifestContainRequiredIcon(manifest)) | 347 if (!DoesManifestContainRequiredIcon(manifest)) |
| 346 return false; | 348 return false; |
| 347 return true; | 349 return true; |
| 348 } | 350 } |
| 349 | 351 |
| 350 } // namespace banners | 352 } // namespace banners |
| OLD | NEW |