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