OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "chrome/browser/host_zoom_map.h" | 43 #include "chrome/browser/host_zoom_map.h" |
44 #include "chrome/browser/hung_renderer_dialog.h" | 44 #include "chrome/browser/hung_renderer_dialog.h" |
45 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" | 45 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
46 #include "chrome/browser/load_from_memory_cache_details.h" | 46 #include "chrome/browser/load_from_memory_cache_details.h" |
47 #include "chrome/browser/load_notification_details.h" | 47 #include "chrome/browser/load_notification_details.h" |
48 #include "chrome/browser/metrics/metric_event_duration_details.h" | 48 #include "chrome/browser/metrics/metric_event_duration_details.h" |
49 #include "chrome/browser/metrics/user_metrics.h" | 49 #include "chrome/browser/metrics/user_metrics.h" |
50 #include "chrome/browser/modal_html_dialog_delegate.h" | 50 #include "chrome/browser/modal_html_dialog_delegate.h" |
51 #include "chrome/browser/omnibox_search_hint.h" | 51 #include "chrome/browser/omnibox_search_hint.h" |
52 #include "chrome/browser/platform_util.h" | 52 #include "chrome/browser/platform_util.h" |
53 #include "chrome/browser/plugin_installer.h" | 53 #include "chrome/browser/plugin_installer_infobar_delegate.h" |
54 #include "chrome/browser/prefs/pref_service.h" | 54 #include "chrome/browser/prefs/pref_service.h" |
55 #include "chrome/browser/prerender/prerender_manager.h" | 55 #include "chrome/browser/prerender/prerender_manager.h" |
56 #include "chrome/browser/printing/print_preview_tab_controller.h" | 56 #include "chrome/browser/printing/print_preview_tab_controller.h" |
57 #include "chrome/browser/printing/print_view_manager.h" | 57 #include "chrome/browser/printing/print_view_manager.h" |
58 #include "chrome/browser/profiles/profile.h" | 58 #include "chrome/browser/profiles/profile.h" |
59 #include "chrome/browser/renderer_host/render_process_host.h" | 59 #include "chrome/browser/renderer_host/render_process_host.h" |
60 #include "chrome/browser/renderer_host/render_view_host.h" | 60 #include "chrome/browser/renderer_host/render_view_host.h" |
61 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 61 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
62 #include "chrome/browser/renderer_host/resource_request_details.h" | 62 #include "chrome/browser/renderer_host/resource_request_details.h" |
63 #include "chrome/browser/renderer_host/site_instance.h" | 63 #include "chrome/browser/renderer_host/site_instance.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 params->current_history_list_length = controller.entry_count(); | 239 params->current_history_list_length = controller.entry_count(); |
240 params->url = entry.url(); | 240 params->url = entry.url(); |
241 params->referrer = entry.referrer(); | 241 params->referrer = entry.referrer(); |
242 params->transition = entry.transition_type(); | 242 params->transition = entry.transition_type(); |
243 params->state = entry.content_state(); | 243 params->state = entry.content_state(); |
244 params->navigation_type = | 244 params->navigation_type = |
245 GetNavigationType(controller.profile(), entry, reload_type); | 245 GetNavigationType(controller.profile(), entry, reload_type); |
246 params->request_time = base::Time::Now(); | 246 params->request_time = base::Time::Now(); |
247 } | 247 } |
248 | 248 |
249 | |
250 // OutdatedPluginInfoBar ------------------------------------------------------ | |
251 | |
249 class OutdatedPluginInfoBar : public ConfirmInfoBarDelegate { | 252 class OutdatedPluginInfoBar : public ConfirmInfoBarDelegate { |
250 public: | 253 public: |
251 OutdatedPluginInfoBar(TabContents* tab_contents, | 254 OutdatedPluginInfoBar(TabContents* tab_contents, |
252 const string16& name, | 255 const string16& name, |
253 const GURL& update_url) | 256 const GURL& update_url); |
254 : ConfirmInfoBarDelegate(tab_contents), | |
255 tab_contents_(tab_contents), | |
256 name_(name), | |
257 update_url_(update_url) { | |
258 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); | |
259 tab_contents->AddInfoBar(this); | |
260 } | |
261 | |
262 virtual int GetButtons() const { | |
263 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT; | |
264 } | |
265 | |
266 virtual string16 GetButtonLabel(InfoBarButton button) const { | |
267 if (button == BUTTON_CANCEL) | |
268 return l10n_util::GetStringUTF16(IDS_PLUGIN_ENABLE_TEMPORARILY); | |
269 if (button == BUTTON_OK) | |
270 return l10n_util::GetStringUTF16(IDS_PLUGIN_UPDATE); | |
271 return ConfirmInfoBarDelegate::GetButtonLabel(button); | |
272 } | |
273 | |
274 virtual string16 GetMessageText() const { | |
275 return l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, name_); | |
276 } | |
277 | |
278 virtual string16 GetLinkText() { | |
279 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
280 } | |
281 | |
282 virtual SkBitmap* GetIcon() const { | |
283 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
284 IDR_INFOBAR_PLUGIN_INSTALL); | |
285 } | |
286 | |
287 virtual bool Accept() { | |
288 UserMetrics::RecordAction( | |
289 UserMetricsAction("OutdatedPluginInfobar.Update")); | |
290 tab_contents_->OpenURL(update_url_, GURL(), | |
291 NEW_FOREGROUND_TAB, PageTransition::LINK); | |
292 return false; | |
293 } | |
294 | |
295 virtual bool Cancel() { | |
296 UserMetrics::RecordAction( | |
297 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); | |
298 tab_contents_->render_view_host()->LoadBlockedPlugins(); | |
299 return true; | |
300 } | |
301 | |
302 virtual bool LinkClicked(WindowOpenDisposition disposition) { | |
303 UserMetrics::RecordAction( | |
304 UserMetricsAction("OutdatedPluginInfobar.LearnMore")); | |
305 // TODO(bauerb): Navigate to a help page explaining why we disabled | |
306 // the plugin, once we have one. | |
307 return false; | |
308 } | |
309 | |
310 virtual void InfoBarClosed() { | |
311 UserMetrics::RecordAction( | |
312 UserMetricsAction("OutdatedPluginInfobar.Closed")); | |
313 delete this; | |
314 } | |
315 | 257 |
316 private: | 258 private: |
259 virtual ~OutdatedPluginInfoBar(); | |
260 | |
261 // ConfirmInfoBarDelegate: | |
262 virtual void InfoBarClosed(); | |
263 virtual SkBitmap* GetIcon() const; | |
264 virtual string16 GetMessageText() const; | |
265 virtual int GetButtons() const; | |
266 virtual string16 GetButtonLabel(InfoBarButton button) const; | |
267 virtual bool Accept(); | |
268 virtual bool Cancel(); | |
269 virtual string16 GetLinkText(); | |
270 virtual bool LinkClicked(WindowOpenDisposition disposition); | |
271 | |
317 TabContents* tab_contents_; | 272 TabContents* tab_contents_; |
318 string16 name_; | 273 string16 name_; |
319 GURL update_url_; | 274 GURL update_url_; |
320 }; | 275 }; |
321 | 276 |
277 OutdatedPluginInfoBar::OutdatedPluginInfoBar(TabContents* tab_contents, | |
278 const string16& name, | |
279 const GURL& update_url) | |
280 : ConfirmInfoBarDelegate(tab_contents), | |
281 tab_contents_(tab_contents), | |
282 name_(name), | |
283 update_url_(update_url) { | |
284 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); | |
285 tab_contents->AddInfoBar(this); | |
286 } | |
287 | |
288 OutdatedPluginInfoBar::~OutdatedPluginInfoBar() { | |
289 } | |
290 | |
291 void OutdatedPluginInfoBar::InfoBarClosed() { | |
292 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Closed")); | |
293 delete this; | |
294 } | |
295 | |
296 SkBitmap* OutdatedPluginInfoBar::GetIcon() const { | |
297 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
298 IDR_INFOBAR_PLUGIN_INSTALL); | |
299 } | |
300 | |
301 string16 OutdatedPluginInfoBar::GetMessageText() const { | |
302 return l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, name_); | |
303 } | |
304 | |
305 int OutdatedPluginInfoBar::GetButtons() const { | |
306 return BUTTON_OK | BUTTON_CANCEL; | |
307 } | |
308 | |
309 string16 OutdatedPluginInfoBar::GetButtonLabel(InfoBarButton button) const { | |
310 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | |
311 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); | |
312 } | |
313 | |
314 bool OutdatedPluginInfoBar::Accept() { | |
315 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); | |
316 tab_contents_->OpenURL(update_url_, GURL(), NEW_FOREGROUND_TAB, | |
317 PageTransition::LINK); | |
318 return false; | |
319 } | |
320 | |
321 bool OutdatedPluginInfoBar::Cancel() { | |
322 UserMetrics::RecordAction( | |
323 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); | |
324 tab_contents_->render_view_host()->LoadBlockedPlugins(); | |
325 return false; | |
326 } | |
327 | |
328 string16 OutdatedPluginInfoBar::GetLinkText() { | |
329 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
330 } | |
331 | |
332 bool OutdatedPluginInfoBar::LinkClicked(WindowOpenDisposition disposition) { | |
333 UserMetrics::RecordAction( | |
334 UserMetricsAction("OutdatedPluginInfobar.LearnMore")); | |
335 // TODO(bauerb): Navigate to a help page explaining why we disabled | |
336 // the plugin, once we have one. | |
337 return false; | |
338 } | |
339 | |
322 } // namespace | 340 } // namespace |
323 | 341 |
324 // ----------------------------------------------------------------------------- | 342 |
343 // TabContents ---------------------------------------------------------------- | |
325 | 344 |
326 // static | 345 // static |
327 int TabContents::find_request_id_counter_ = -1; | 346 int TabContents::find_request_id_counter_ = -1; |
328 | 347 |
329 | 348 |
330 TabContents::TabContents(Profile* profile, | 349 TabContents::TabContents(Profile* profile, |
331 SiteInstance* site_instance, | 350 SiteInstance* site_instance, |
332 int routing_id, | 351 int routing_id, |
333 const TabContents* base_tab_contents, | 352 const TabContents* base_tab_contents, |
334 SessionStorageNamespace* session_storage_namespace) | 353 SessionStorageNamespace* session_storage_namespace) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 } | 621 } |
603 | 622 |
604 return handled; | 623 return handled; |
605 } | 624 } |
606 | 625 |
607 // Returns true if contains content rendered by an extension. | 626 // Returns true if contains content rendered by an extension. |
608 bool TabContents::HostsExtension() const { | 627 bool TabContents::HostsExtension() const { |
609 return GetURL().SchemeIs(chrome::kExtensionScheme); | 628 return GetURL().SchemeIs(chrome::kExtensionScheme); |
610 } | 629 } |
611 | 630 |
612 PluginInstaller* TabContents::GetPluginInstaller() { | 631 PluginInstallerInfoBarDelegate* TabContents::GetPluginInstaller() { |
613 if (plugin_installer_.get() == NULL) | 632 if (plugin_installer_.get() == NULL) |
614 plugin_installer_.reset(new PluginInstaller(this)); | 633 plugin_installer_.reset(new PluginInstallerInfoBarDelegate(this)); |
615 return plugin_installer_.get(); | 634 return plugin_installer_.get(); |
616 } | 635 } |
617 | 636 |
618 TabContentsSSLHelper* TabContents::GetSSLHelper() { | 637 TabContentsSSLHelper* TabContents::GetSSLHelper() { |
619 if (ssl_helper_.get() == NULL) | 638 if (ssl_helper_.get() == NULL) |
620 ssl_helper_.reset(new TabContentsSSLHelper(this)); | 639 ssl_helper_.reset(new TabContentsSSLHelper(this)); |
621 return ssl_helper_.get(); | 640 return ssl_helper_.get(); |
622 } | 641 } |
623 | 642 |
624 RenderProcessHost* TabContents::GetRenderProcessHost() const { | 643 RenderProcessHost* TabContents::GetRenderProcessHost() const { |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1182 for (int i = 0; i < infobar_delegate_count(); ++i) { | 1201 for (int i = 0; i < infobar_delegate_count(); ++i) { |
1183 if (GetInfoBarDelegateAt(i)->EqualsDelegate(delegate)) { | 1202 if (GetInfoBarDelegateAt(i)->EqualsDelegate(delegate)) { |
1184 // Tell the new infobar to close so that it can clean itself up. | 1203 // Tell the new infobar to close so that it can clean itself up. |
1185 delegate->InfoBarClosed(); | 1204 delegate->InfoBarClosed(); |
1186 return; | 1205 return; |
1187 } | 1206 } |
1188 } | 1207 } |
1189 | 1208 |
1190 infobar_delegates_.push_back(delegate); | 1209 infobar_delegates_.push_back(delegate); |
1191 NotificationService::current()->Notify( | 1210 NotificationService::current()->Notify( |
1192 NotificationType::TAB_CONTENTS_INFOBAR_ADDED, | 1211 NotificationType::TAB_CONTENTS_INFOBAR_ADDED, Source<TabContents>(this), |
1193 Source<TabContents>(this), | |
1194 Details<InfoBarDelegate>(delegate)); | 1212 Details<InfoBarDelegate>(delegate)); |
1195 | 1213 |
1196 // Add ourselves as an observer for navigations the first time a delegate is | 1214 // Add ourselves as an observer for navigations the first time a delegate is |
1197 // added. We use this notification to expire InfoBars that need to expire on | 1215 // added. We use this notification to expire InfoBars that need to expire on |
1198 // page transitions. | 1216 // page transitions. |
1199 if (infobar_delegates_.size() == 1) { | 1217 if (infobar_delegates_.size() == 1) { |
1200 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, | 1218 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, |
1201 Source<NavigationController>(&controller_)); | 1219 Source<NavigationController>(&controller_)); |
1202 } | 1220 } |
1203 } | 1221 } |
1204 | 1222 |
1205 void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) { | 1223 void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) { |
1206 if (delegate_ && !delegate_->infobars_enabled()) { | 1224 if (delegate_ && !delegate_->infobars_enabled()) { |
1207 return; | 1225 return; |
1208 } | 1226 } |
1209 | 1227 |
1210 std::vector<InfoBarDelegate*>::iterator it = | 1228 std::vector<InfoBarDelegate*>::iterator it = |
1211 find(infobar_delegates_.begin(), infobar_delegates_.end(), delegate); | 1229 find(infobar_delegates_.begin(), infobar_delegates_.end(), delegate); |
1212 if (it != infobar_delegates_.end()) { | 1230 if (it != infobar_delegates_.end()) { |
1213 InfoBarDelegate* delegate = *it; | 1231 InfoBarDelegate* delegate = *it; |
1214 NotificationService::current()->Notify( | 1232 NotificationService::current()->Notify( |
1215 NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, | 1233 NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, |
1216 Source<TabContents>(this), | 1234 Source<TabContents>(this), |
1217 Details<InfoBarDelegate>(delegate)); | 1235 Details<InfoBarDelegate>(delegate)); |
1218 | 1236 |
1219 // Just to be safe, make sure the delegate was not removed by an observer. | 1237 infobar_delegates_.erase(it); |
Elliot Glaysher
2011/01/20 01:02:03
I assume that this safety code is obsolete?
Peter Kasting
2011/01/20 01:45:14
Yes. There's no current code that would trip this
| |
1220 it = find(infobar_delegates_.begin(), infobar_delegates_.end(), delegate); | 1238 // Remove ourselves as an observer if we are tracking no more InfoBars. |
1221 if (it != infobar_delegates_.end()) { | 1239 if (infobar_delegates_.empty()) { |
1222 infobar_delegates_.erase(it); | 1240 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, |
1223 // Remove ourselves as an observer if we are tracking no more InfoBars. | 1241 Source<NavigationController>(&controller_)); |
1224 if (infobar_delegates_.empty()) { | |
1225 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, | |
1226 Source<NavigationController>(&controller_)); | |
1227 } | |
1228 } else { | |
1229 // If you hit this NOTREACHED, please comment in bug | |
1230 // http://crbug.com/50428 how you got there. | |
1231 NOTREACHED(); | |
1232 } | 1242 } |
1233 } | 1243 } |
1234 } | 1244 } |
1235 | 1245 |
1236 void TabContents::ReplaceInfoBar(InfoBarDelegate* old_delegate, | 1246 void TabContents::ReplaceInfoBar(InfoBarDelegate* old_delegate, |
1237 InfoBarDelegate* new_delegate) { | 1247 InfoBarDelegate* new_delegate) { |
1238 if (delegate_ && !delegate_->infobars_enabled()) { | 1248 if (delegate_ && !delegate_->infobars_enabled()) { |
1239 new_delegate->InfoBarClosed(); | 1249 new_delegate->InfoBarClosed(); |
1240 return; | 1250 return; |
1241 } | 1251 } |
1242 | 1252 |
1243 std::vector<InfoBarDelegate*>::iterator it = | 1253 std::vector<InfoBarDelegate*>::iterator it = |
1244 find(infobar_delegates_.begin(), infobar_delegates_.end(), old_delegate); | 1254 find(infobar_delegates_.begin(), infobar_delegates_.end(), old_delegate); |
1245 DCHECK(it != infobar_delegates_.end()); | 1255 DCHECK(it != infobar_delegates_.end()); |
1246 | 1256 |
1247 // Notify the container about the change of plans. | 1257 // Notify the container about the change of plans. |
1248 scoped_ptr<std::pair<InfoBarDelegate*, InfoBarDelegate*> > details( | 1258 scoped_ptr<std::pair<InfoBarDelegate*, InfoBarDelegate*> > details( |
1249 new std::pair<InfoBarDelegate*, InfoBarDelegate*>( | 1259 new std::pair<InfoBarDelegate*, InfoBarDelegate*>( |
1250 old_delegate, new_delegate)); | 1260 old_delegate, new_delegate)); |
1251 NotificationService::current()->Notify( | 1261 NotificationService::current()->Notify( |
1252 NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, | 1262 NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, |
1253 Source<TabContents>(this), | 1263 Source<TabContents>(this), |
1254 Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details.get())); | 1264 Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details.get())); |
1255 | 1265 |
1256 // Just to be safe, make sure the delegate was not removed by an observer. | 1266 // Remove the old one. |
1257 it = find(infobar_delegates_.begin(), infobar_delegates_.end(), old_delegate); | 1267 infobar_delegates_.erase(it); |
1258 if (it != infobar_delegates_.end()) { | |
1259 // Remove the old one. | |
1260 infobar_delegates_.erase(it); | |
1261 } else { | |
1262 // If you hit this NOTREACHED, please comment in bug | |
1263 // http://crbug.com/50428 how you got there. | |
1264 NOTREACHED(); | |
1265 } | |
1266 | 1268 |
1267 // Add the new one. | 1269 // Add the new one. |
1268 DCHECK(find(infobar_delegates_.begin(), | 1270 DCHECK(find(infobar_delegates_.begin(), |
1269 infobar_delegates_.end(), new_delegate) == | 1271 infobar_delegates_.end(), new_delegate) == |
1270 infobar_delegates_.end()); | 1272 infobar_delegates_.end()); |
1271 infobar_delegates_.push_back(new_delegate); | 1273 infobar_delegates_.push_back(new_delegate); |
1272 } | 1274 } |
1273 | 1275 |
1274 bool TabContents::ShouldShowBookmarkBar() { | 1276 bool TabContents::ShouldShowBookmarkBar() { |
1275 if (showing_interstitial_page()) | 1277 if (showing_interstitial_page()) |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1835 void TabContents::ExpireInfoBars( | 1837 void TabContents::ExpireInfoBars( |
1836 const NavigationController::LoadCommittedDetails& details) { | 1838 const NavigationController::LoadCommittedDetails& details) { |
1837 // Only hide InfoBars when the user has done something that makes the main | 1839 // Only hide InfoBars when the user has done something that makes the main |
1838 // frame load. We don't want various automatic or subframe navigations making | 1840 // frame load. We don't want various automatic or subframe navigations making |
1839 // it disappear. | 1841 // it disappear. |
1840 if (!details.is_user_initiated_main_frame_load()) | 1842 if (!details.is_user_initiated_main_frame_load()) |
1841 return; | 1843 return; |
1842 | 1844 |
1843 for (int i = infobar_delegate_count() - 1; i >= 0; --i) { | 1845 for (int i = infobar_delegate_count() - 1; i >= 0; --i) { |
1844 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i); | 1846 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i); |
1845 if (!delegate) { | |
1846 // If you hit this NOTREACHED, please comment in bug | |
1847 // http://crbug.com/50428 how you got there. | |
1848 NOTREACHED(); | |
1849 continue; | |
1850 } | |
1851 | |
1852 if (delegate->ShouldExpire(details)) | 1847 if (delegate->ShouldExpire(details)) |
1853 RemoveInfoBar(delegate); | 1848 RemoveInfoBar(delegate); |
1854 } | 1849 } |
1855 } | 1850 } |
1856 | 1851 |
1857 DOMUI* TabContents::GetDOMUIForCurrentState() { | 1852 DOMUI* TabContents::GetDOMUIForCurrentState() { |
1858 // When there is a pending navigation entry, we want to use the pending DOMUI | 1853 // When there is a pending navigation entry, we want to use the pending DOMUI |
1859 // that goes along with it to control the basic flags. For example, we want to | 1854 // that goes along with it to control the basic flags. For example, we want to |
1860 // show the pending URL in the URL bar, so we want the display_url flag to | 1855 // show the pending URL in the URL bar, so we want the display_url flag to |
1861 // be from the pending entry. | 1856 // be from the pending entry. |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2309 #if defined(OS_MACOSX) | 2304 #if defined(OS_MACOSX) |
2310 // Many plugins on the Mac have .plugin in the actual name, which looks | 2305 // Many plugins on the Mac have .plugin in the actual name, which looks |
2311 // terrible, so look for that and strip it off if present. | 2306 // terrible, so look for that and strip it off if present. |
2312 const std::wstring plugin_extension(L".plugin"); | 2307 const std::wstring plugin_extension(L".plugin"); |
2313 if (EndsWith(plugin_name, plugin_extension, true)) | 2308 if (EndsWith(plugin_name, plugin_extension, true)) |
2314 plugin_name.erase(plugin_name.length() - plugin_extension.length()); | 2309 plugin_name.erase(plugin_name.length() - plugin_extension.length()); |
2315 #endif // OS_MACOSX | 2310 #endif // OS_MACOSX |
2316 } | 2311 } |
2317 SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 2312 SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( |
2318 IDR_INFOBAR_PLUGIN_CRASHED); | 2313 IDR_INFOBAR_PLUGIN_CRASHED); |
2319 AddInfoBar(new SimpleAlertInfoBarDelegate( | 2314 AddInfoBar(new SimpleAlertInfoBarDelegate(this, crash_icon, |
2320 this, l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, | 2315 l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, |
2321 WideToUTF16Hack(plugin_name)), | 2316 WideToUTF16Hack(plugin_name)), true)); |
2322 crash_icon, true)); | |
2323 } | 2317 } |
2324 | 2318 |
2325 void TabContents::OnCrashedWorker() { | 2319 void TabContents::OnCrashedWorker() { |
2326 AddInfoBar(new SimpleAlertInfoBarDelegate( | 2320 AddInfoBar(new SimpleAlertInfoBarDelegate(this, NULL, |
2327 this, l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT), | 2321 l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT), true)); |
2328 NULL, true)); | |
2329 } | 2322 } |
2330 | 2323 |
2331 void TabContents::OnDidGetApplicationInfo(int32 page_id, | 2324 void TabContents::OnDidGetApplicationInfo(int32 page_id, |
2332 const WebApplicationInfo& info) { | 2325 const WebApplicationInfo& info) { |
2333 web_app_info_ = info; | 2326 web_app_info_ = info; |
2334 | 2327 |
2335 if (delegate()) | 2328 if (delegate()) |
2336 delegate()->OnDidGetApplicationInfo(this, page_id); | 2329 delegate()->OnDidGetApplicationInfo(this, page_id); |
2337 } | 2330 } |
2338 | 2331 |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3053 } | 3046 } |
3054 | 3047 |
3055 void TabContents::OnIgnoredUIEvent() { | 3048 void TabContents::OnIgnoredUIEvent() { |
3056 if (constrained_window_count()) { | 3049 if (constrained_window_count()) { |
3057 ConstrainedWindow* window = *constrained_window_begin(); | 3050 ConstrainedWindow* window = *constrained_window_begin(); |
3058 window->FocusConstrainedWindow(); | 3051 window->FocusConstrainedWindow(); |
3059 } | 3052 } |
3060 } | 3053 } |
3061 | 3054 |
3062 void TabContents::OnJSOutOfMemory() { | 3055 void TabContents::OnJSOutOfMemory() { |
3063 AddInfoBar(new SimpleAlertInfoBarDelegate( | 3056 AddInfoBar(new SimpleAlertInfoBarDelegate(this, NULL, |
3064 this, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), | 3057 l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true)); |
3065 NULL, true)); | |
3066 } | 3058 } |
3067 | 3059 |
3068 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, | 3060 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, |
3069 int new_request_id) { | 3061 int new_request_id) { |
3070 // Allows the TabContents to react when a cross-site response is ready to be | 3062 // Allows the TabContents to react when a cross-site response is ready to be |
3071 // delivered to a pending RenderViewHost. We must first run the onunload | 3063 // delivered to a pending RenderViewHost. We must first run the onunload |
3072 // handler of the old RenderViewHost before we can allow it to proceed. | 3064 // handler of the old RenderViewHost before we can allow it to proceed. |
3073 render_manager_.OnCrossSiteResponse(new_render_process_host_id, | 3065 render_manager_.OnCrossSiteResponse(new_render_process_host_id, |
3074 new_request_id); | 3066 new_request_id); |
3075 } | 3067 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3386 if (pm != NULL) { | 3378 if (pm != NULL) { |
3387 if (pm->MaybeUsePreloadedPage(this, url)) { | 3379 if (pm->MaybeUsePreloadedPage(this, url)) { |
3388 // TODO(tburkard): If the preloaded page has not finished preloading | 3380 // TODO(tburkard): If the preloaded page has not finished preloading |
3389 // yet, we should not do this. | 3381 // yet, we should not do this. |
3390 DidStopLoading(); | 3382 DidStopLoading(); |
3391 return true; | 3383 return true; |
3392 } | 3384 } |
3393 } | 3385 } |
3394 return false; | 3386 return false; |
3395 } | 3387 } |
OLD | NEW |