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

Side by Side Diff: chrome/browser/banners/app_banner_infobar_delegate_desktop.cc

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Add TODO Created 4 years, 1 month 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
OLDNEW
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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "build/build_config.h"
9 #include "chrome/browser/banners/app_banner_manager.h" 10 #include "chrome/browser/banners/app_banner_manager.h"
10 #include "chrome/browser/banners/app_banner_metrics.h" 11 #include "chrome/browser/banners/app_banner_metrics.h"
11 #include "chrome/browser/banners/app_banner_settings_helper.h" 12 #include "chrome/browser/banners/app_banner_settings_helper.h"
12 #include "chrome/browser/extensions/bookmark_app_helper.h" 13 #include "chrome/browser/extensions/bookmark_app_helper.h"
13 #include "chrome/browser/infobars/infobar_service.h" 14 #include "chrome/browser/infobars/infobar_service.h"
14 #include "chrome/common/render_messages.h"
15 #include "chrome/common/web_application_info.h" 15 #include "chrome/common/web_application_info.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "components/infobars/core/infobar.h" 17 #include "components/infobars/core/infobar.h"
18 #include "content/public/browser/render_frame_host.h"
19 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
20 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/gfx/vector_icons_public.h" 20 #include "ui/gfx/vector_icons_public.h"
22 21
23 namespace banners { 22 namespace banners {
24 23
25 // static 24 // static
26 infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create( 25 infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create(
27 content::WebContents* web_contents, 26 content::WebContents* web_contents,
28 base::WeakPtr<AppBannerManager> weak_manager, 27 base::WeakPtr<AppBannerManager> weak_manager,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return gfx::VectorIconId::APPS; 68 return gfx::VectorIconId::APPS;
70 } 69 }
71 70
72 void AppBannerInfoBarDelegateDesktop::InfoBarDismissed() { 71 void AppBannerInfoBarDelegateDesktop::InfoBarDismissed() {
73 TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED); 72 TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED);
74 has_user_interaction_ = true; 73 has_user_interaction_ = true;
75 74
76 content::WebContents* web_contents = 75 content::WebContents* web_contents =
77 InfoBarService::WebContentsFromInfoBar(infobar()); 76 InfoBarService::WebContentsFromInfoBar(infobar());
78 if (web_contents) { 77 if (web_contents) {
79 web_contents->GetMainFrame()->Send( 78 if (weak_manager_)
80 new ChromeViewMsg_AppBannerDismissed( 79 weak_manager_->SendBannerDismissed(event_request_id_);
81 web_contents->GetMainFrame()->GetRoutingID(),
82 event_request_id_));
83 80
84 AppBannerSettingsHelper::RecordBannerDismissEvent( 81 AppBannerSettingsHelper::RecordBannerDismissEvent(
85 web_contents, manifest_.start_url.spec(), AppBannerSettingsHelper::WEB); 82 web_contents, manifest_.start_url.spec(), AppBannerSettingsHelper::WEB);
86 } 83 }
87 } 84 }
88 85
89 base::string16 AppBannerInfoBarDelegateDesktop::GetMessageText() const { 86 base::string16 AppBannerInfoBarDelegateDesktop::GetMessageText() const {
90 return l10n_util::GetStringUTF16(IDS_ADD_TO_SHELF_INFOBAR_TITLE); 87 return l10n_util::GetStringUTF16(IDS_ADD_TO_SHELF_INFOBAR_TITLE);
91 } 88 }
92 89
(...skipping 11 matching lines...) Expand all
104 has_user_interaction_ = true; 101 has_user_interaction_ = true;
105 102
106 bookmark_app_helper_->CreateFromAppBanner( 103 bookmark_app_helper_->CreateFromAppBanner(
107 base::Bind(&AppBannerManager::DidFinishCreatingBookmarkApp, 104 base::Bind(&AppBannerManager::DidFinishCreatingBookmarkApp,
108 weak_manager_), 105 weak_manager_),
109 manifest_); 106 manifest_);
110 return true; 107 return true;
111 } 108 }
112 109
113 } // namespace banners 110 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager_android.cc ('k') | chrome/browser/banners/app_banner_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698