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

Side by Side Diff: chrome/browser/geolocation/geolocation_infobar_delegate.cc

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/geolocation/geolocation_infobar_delegate.h" 5 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/content_settings/permission_queue_controller.h" 8 #include "chrome/browser/content_settings/permission_queue_controller.h"
9 #include "chrome/browser/google/google_util.h" 9 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/infobars/infobar.h"
11 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "components/infobars/core/infobar.h"
12 #include "content/public/browser/navigation_details.h" 12 #include "content/public/browser/navigation_details.h"
13 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "grit/locale_settings.h" 16 #include "grit/locale_settings.h"
17 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
18 #include "net/base/net_util.h" 18 #include "net/base/net_util.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 20
21 #if defined(OS_ANDROID) 21 #if defined(OS_ANDROID)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }; 55 };
56 56
57 void RecordUmaEvent(GeolocationInfoBarDelegateEvent event) { 57 void RecordUmaEvent(GeolocationInfoBarDelegateEvent event) {
58 UMA_HISTOGRAM_ENUMERATION("Geolocation.InfoBarDelegate.Event", 58 UMA_HISTOGRAM_ENUMERATION("Geolocation.InfoBarDelegate.Event",
59 event, GEOLOCATION_INFO_BAR_DELEGATE_EVENT_COUNT); 59 event, GEOLOCATION_INFO_BAR_DELEGATE_EVENT_COUNT);
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 // static 64 // static
65 InfoBar* GeolocationInfoBarDelegate::Create( 65 infobars::InfoBar* GeolocationInfoBarDelegate::Create(
66 InfoBarService* infobar_service, 66 InfoBarService* infobar_service,
67 PermissionQueueController* controller, 67 PermissionQueueController* controller,
68 const PermissionRequestID& id, 68 const PermissionRequestID& id,
69 const GURL& requesting_frame, 69 const GURL& requesting_frame,
70 const std::string& display_languages, 70 const std::string& display_languages,
71 const std::string& accept_button_label) { 71 const std::string& accept_button_label) {
72 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_CREATE); 72 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_CREATE);
73 const content::NavigationEntry* committed_entry = 73 const content::NavigationEntry* committed_entry =
74 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); 74 infobar_service->web_contents()->GetController().GetLastCommittedEntry();
75 GeolocationInfoBarDelegate* const delegate = new DelegateType( 75 GeolocationInfoBarDelegate* const delegate = new DelegateType(
76 controller, id, requesting_frame, 76 controller, id, requesting_frame,
77 committed_entry ? committed_entry->GetUniqueID() : 0, 77 committed_entry ? committed_entry->GetUniqueID() : 0,
78 display_languages, accept_button_label); 78 display_languages, accept_button_label);
79 79
80 InfoBar* infobar = ConfirmInfoBarDelegate::CreateInfoBar( 80 infobars::InfoBar* infobar = ConfirmInfoBarDelegate::CreateInfoBar(
81 scoped_ptr<ConfirmInfoBarDelegate>(delegate)).release(); 81 scoped_ptr<ConfirmInfoBarDelegate>(delegate)).release();
82 return infobar_service->AddInfoBar(scoped_ptr<InfoBar>(infobar)); 82 return infobar_service->AddInfoBar(scoped_ptr<infobars::InfoBar>(infobar));
83 } 83 }
84 84
85 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( 85 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate(
86 PermissionQueueController* controller, 86 PermissionQueueController* controller,
87 const PermissionRequestID& id, 87 const PermissionRequestID& id,
88 const GURL& requesting_frame, 88 const GURL& requesting_frame,
89 int contents_unique_id, 89 int contents_unique_id,
90 const std::string& display_languages, 90 const std::string& display_languages,
91 const std::string& accept_button_label) 91 const std::string& accept_button_label)
92 : ConfirmInfoBarDelegate(), 92 : ConfirmInfoBarDelegate(),
(...skipping 30 matching lines...) Expand all
123 void GeolocationInfoBarDelegate::InfoBarDismissed() { 123 void GeolocationInfoBarDelegate::InfoBarDismissed() {
124 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS); 124 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS);
125 set_user_has_interacted(); 125 set_user_has_interacted();
126 SetPermission(false, false); 126 SetPermission(false, false);
127 } 127 }
128 128
129 int GeolocationInfoBarDelegate::GetIconID() const { 129 int GeolocationInfoBarDelegate::GetIconID() const {
130 return IDR_INFOBAR_GEOLOCATION; 130 return IDR_INFOBAR_GEOLOCATION;
131 } 131 }
132 132
133 InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType() const { 133 infobars::InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType()
134 const {
134 return PAGE_ACTION_TYPE; 135 return PAGE_ACTION_TYPE;
135 } 136 }
136 137
137 bool GeolocationInfoBarDelegate::ShouldExpireInternal( 138 bool GeolocationInfoBarDelegate::ShouldExpireInternal(
138 const NavigationDetails& details) const { 139 const NavigationDetails& details) const {
139 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but 140 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but
140 // uses the unique ID we set in the constructor instead of that stored in the 141 // uses the unique ID we set in the constructor instead of that stored in the
141 // base class. 142 // base class.
142 return (contents_unique_id_ != details.entry_id) || details.is_reload; 143 return (contents_unique_id_ != details.entry_id) || details.is_reload;
143 } 144 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 #endif 178 #endif
178 179
179 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( 180 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
180 content::OpenURLParams( 181 content::OpenURLParams(
181 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), 182 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)),
182 content::Referrer(), 183 content::Referrer(),
183 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 184 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
184 content::PAGE_TRANSITION_LINK, false)); 185 content::PAGE_TRANSITION_LINK, false));
185 return false; // Do not dismiss the info bar. 186 return false; // Do not dismiss the info bar.
186 } 187 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_infobar_delegate.h ('k') | chrome/browser/google/google_url_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698