| 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_infobar_delegate_desktop.h" | 5 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/app/vector_icons/vector_icons.h" |
| 10 #include "chrome/browser/banners/app_banner_manager.h" | 11 #include "chrome/browser/banners/app_banner_manager.h" |
| 11 #include "chrome/browser/banners/app_banner_metrics.h" | 12 #include "chrome/browser/banners/app_banner_metrics.h" |
| 12 #include "chrome/browser/banners/app_banner_settings_helper.h" | 13 #include "chrome/browser/banners/app_banner_settings_helper.h" |
| 13 #include "chrome/browser/extensions/bookmark_app_helper.h" | 14 #include "chrome/browser/extensions/bookmark_app_helper.h" |
| 14 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 15 #include "chrome/common/web_application_info.h" | 16 #include "chrome/common/web_application_info.h" |
| 16 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/infobars/core/infobar.h" | 18 #include "components/infobars/core/infobar.h" |
| 18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/gfx/vector_icons_public.h" | |
| 21 | 21 |
| 22 namespace banners { | 22 namespace banners { |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create( | 25 infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create( |
| 26 content::WebContents* web_contents, | 26 content::WebContents* web_contents, |
| 27 base::WeakPtr<AppBannerManager> weak_manager, | 27 base::WeakPtr<AppBannerManager> weak_manager, |
| 28 extensions::BookmarkAppHelper* bookmark_app_helper, | 28 extensions::BookmarkAppHelper* bookmark_app_helper, |
| 29 const content::Manifest& manifest, | 29 const content::Manifest& manifest, |
| 30 int event_request_id) { | 30 int event_request_id) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 infobars::InfoBarDelegate::Type | 57 infobars::InfoBarDelegate::Type |
| 58 AppBannerInfoBarDelegateDesktop::GetInfoBarType() const { | 58 AppBannerInfoBarDelegateDesktop::GetInfoBarType() const { |
| 59 return PAGE_ACTION_TYPE; | 59 return PAGE_ACTION_TYPE; |
| 60 } | 60 } |
| 61 | 61 |
| 62 infobars::InfoBarDelegate::InfoBarIdentifier | 62 infobars::InfoBarDelegate::InfoBarIdentifier |
| 63 AppBannerInfoBarDelegateDesktop::GetIdentifier() const { | 63 AppBannerInfoBarDelegateDesktop::GetIdentifier() const { |
| 64 return APP_BANNER_INFOBAR_DELEGATE_DESKTOP; | 64 return APP_BANNER_INFOBAR_DELEGATE_DESKTOP; |
| 65 } | 65 } |
| 66 | 66 |
| 67 gfx::VectorIconId AppBannerInfoBarDelegateDesktop::GetVectorIconId() const { | 67 const gfx::VectorIcon& AppBannerInfoBarDelegateDesktop::GetVectorIcon() const { |
| 68 return gfx::VectorIconId::APPS; | 68 return kAppsIcon; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void AppBannerInfoBarDelegateDesktop::InfoBarDismissed() { | 71 void AppBannerInfoBarDelegateDesktop::InfoBarDismissed() { |
| 72 TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED); | 72 TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED); |
| 73 has_user_interaction_ = true; | 73 has_user_interaction_ = true; |
| 74 | 74 |
| 75 content::WebContents* web_contents = | 75 content::WebContents* web_contents = |
| 76 InfoBarService::WebContentsFromInfoBar(infobar()); | 76 InfoBarService::WebContentsFromInfoBar(infobar()); |
| 77 if (web_contents) { | 77 if (web_contents) { |
| 78 if (weak_manager_) | 78 if (weak_manager_) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 has_user_interaction_ = true; | 101 has_user_interaction_ = true; |
| 102 | 102 |
| 103 bookmark_app_helper_->CreateFromAppBanner( | 103 bookmark_app_helper_->CreateFromAppBanner( |
| 104 base::Bind(&AppBannerManager::DidFinishCreatingBookmarkApp, | 104 base::Bind(&AppBannerManager::DidFinishCreatingBookmarkApp, |
| 105 weak_manager_), | 105 weak_manager_), |
| 106 manifest_); | 106 manifest_); |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace banners | 110 } // namespace banners |
| OLD | NEW |