| 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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | |
| 10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 11 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 12 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
| 13 #include "base/string16.h" | 12 #include "base/string16.h" |
| 14 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 15 #include "base/time.h" | 14 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/blocked_content_container.h" | |
| 18 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browser_shutdown.h" | 17 #include "chrome/browser/browser_shutdown.h" |
| 20 #include "chrome/browser/character_encoding.h" | 18 #include "chrome/browser/character_encoding.h" |
| 21 #include "chrome/browser/content_settings/content_settings_details.h" | |
| 22 #include "chrome/browser/content_settings/host_content_settings_map.h" | |
| 23 #include "chrome/browser/debugger/devtools_manager.h" | 19 #include "chrome/browser/debugger/devtools_manager.h" |
| 24 #include "chrome/browser/defaults.h" | 20 #include "chrome/browser/defaults.h" |
| 25 #include "chrome/browser/dom_operation_notification_details.h" | 21 #include "chrome/browser/dom_operation_notification_details.h" |
| 26 #include "chrome/browser/download/download_item_model.h" | 22 #include "chrome/browser/download/download_item_model.h" |
| 27 #include "chrome/browser/download/download_manager.h" | 23 #include "chrome/browser/download/download_manager.h" |
| 28 #include "chrome/browser/download/download_request_limiter.h" | 24 #include "chrome/browser/download/download_request_limiter.h" |
| 29 #include "chrome/browser/external_protocol_handler.h" | 25 #include "chrome/browser/external_protocol_handler.h" |
| 30 #include "chrome/browser/favicon_service.h" | 26 #include "chrome/browser/favicon_service.h" |
| 31 #include "chrome/browser/google/google_util.h" | 27 #include "chrome/browser/google/google_util.h" |
| 32 #include "chrome/browser/history/history.h" | 28 #include "chrome/browser/history/history.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 bookmark_drag_(NULL), | 227 bookmark_drag_(NULL), |
| 232 is_loading_(false), | 228 is_loading_(false), |
| 233 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 229 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 234 crashed_error_code_(0), | 230 crashed_error_code_(0), |
| 235 waiting_for_response_(false), | 231 waiting_for_response_(false), |
| 236 max_page_id_(-1), | 232 max_page_id_(-1), |
| 237 load_state_(net::LOAD_STATE_IDLE), | 233 load_state_(net::LOAD_STATE_IDLE), |
| 238 upload_size_(0), | 234 upload_size_(0), |
| 239 upload_position_(0), | 235 upload_position_(0), |
| 240 received_page_title_(false), | 236 received_page_title_(false), |
| 241 blocked_contents_(NULL), | |
| 242 all_contents_blocked_(false), | |
| 243 dont_notify_render_view_(false), | |
| 244 displayed_insecure_content_(false), | 237 displayed_insecure_content_(false), |
| 245 capturing_contents_(false), | 238 capturing_contents_(false), |
| 246 is_being_destroyed_(false), | 239 is_being_destroyed_(false), |
| 247 notify_disconnection_(false), | 240 notify_disconnection_(false), |
| 248 #if defined(OS_WIN) | 241 #if defined(OS_WIN) |
| 249 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 242 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 250 #endif | 243 #endif |
| 251 suppress_javascript_messages_(false), | 244 suppress_javascript_messages_(false), |
| 252 is_showing_before_unload_dialog_(false), | 245 is_showing_before_unload_dialog_(false), |
| 253 opener_web_ui_type_(WebUI::kNoWebUI), | 246 opener_web_ui_type_(WebUI::kNoWebUI), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, | 283 registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, |
| 291 NotificationService::AllSources()); | 284 NotificationService::AllSources()); |
| 292 #if defined(OS_LINUX) | 285 #if defined(OS_LINUX) |
| 293 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 286 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, |
| 294 NotificationService::AllSources()); | 287 NotificationService::AllSources()); |
| 295 #endif | 288 #endif |
| 296 | 289 |
| 297 registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, | 290 registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, |
| 298 NotificationService::AllSources()); | 291 NotificationService::AllSources()); |
| 299 | 292 |
| 300 // Register for notifications about content setting changes. | |
| 301 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, | |
| 302 NotificationService::AllSources()); | |
| 303 | |
| 304 // Listen for Google URL changes. | 293 // Listen for Google URL changes. |
| 305 registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, | 294 registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, |
| 306 NotificationService::AllSources()); | 295 NotificationService::AllSources()); |
| 307 | 296 |
| 308 // Set-up the showing of the omnibox search infobar if applicable. | 297 // Set-up the showing of the omnibox search infobar if applicable. |
| 309 if (OmniboxSearchHint::IsEnabled(profile)) | 298 if (OmniboxSearchHint::IsEnabled(profile)) |
| 310 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 299 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
| 311 | 300 |
| 312 // Can only add observers after render_manager_.Init() is called, since that's | 301 // Can only add observers after render_manager_.Init() is called, since that's |
| 313 // what sets up the render_view_host which TabContentObserver's constructor | 302 // what sets up the render_view_host which TabContentObserver's constructor |
| (...skipping 10 matching lines...) Expand all Loading... |
| 324 | 313 |
| 325 NotifyDisconnected(); | 314 NotifyDisconnected(); |
| 326 browser::HideHungRendererDialog(this); | 315 browser::HideHungRendererDialog(this); |
| 327 | 316 |
| 328 // First cleanly close all child windows. | 317 // First cleanly close all child windows. |
| 329 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 318 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 330 // some of these to close. CloseWindows is async, so it might get called | 319 // some of these to close. CloseWindows is async, so it might get called |
| 331 // twice before it runs. | 320 // twice before it runs. |
| 332 CloseConstrainedWindows(); | 321 CloseConstrainedWindows(); |
| 333 | 322 |
| 334 // Close all blocked contents. | |
| 335 if (blocked_contents_) | |
| 336 blocked_contents_->Destroy(); | |
| 337 | |
| 338 // Notify any observer that have a reference on this tab contents. | 323 // Notify any observer that have a reference on this tab contents. |
| 339 NotificationService::current()->Notify( | 324 NotificationService::current()->Notify( |
| 340 NotificationType::TAB_CONTENTS_DESTROYED, | 325 NotificationType::TAB_CONTENTS_DESTROYED, |
| 341 Source<TabContents>(this), | 326 Source<TabContents>(this), |
| 342 NotificationService::NoDetails()); | 327 NotificationService::NoDetails()); |
| 343 | 328 |
| 344 // Notify any lasting InfobarDelegates that have not yet been removed that | 329 // Notify any lasting InfobarDelegates that have not yet been removed that |
| 345 // whatever infobar they were handling in this TabContents has closed, | 330 // whatever infobar they were handling in this TabContents has closed, |
| 346 // because the TabContents is going away entirely. | 331 // because the TabContents is going away entirely. |
| 347 // This must happen after the TAB_CONTENTS_DESTROYED notification as the | 332 // This must happen after the TAB_CONTENTS_DESTROYED notification as the |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 rwhv->SetVisuallyDeemphasized(blocked ? &greyish : NULL, false); | 787 rwhv->SetVisuallyDeemphasized(blocked ? &greyish : NULL, false); |
| 803 render_view_host()->set_ignore_input_events(blocked); | 788 render_view_host()->set_ignore_input_events(blocked); |
| 804 if (delegate_) | 789 if (delegate_) |
| 805 delegate_->SetTabContentBlocked(this, blocked); | 790 delegate_->SetTabContentBlocked(this, blocked); |
| 806 } | 791 } |
| 807 | 792 |
| 808 void TabContents::AddNewContents(TabContents* new_contents, | 793 void TabContents::AddNewContents(TabContents* new_contents, |
| 809 WindowOpenDisposition disposition, | 794 WindowOpenDisposition disposition, |
| 810 const gfx::Rect& initial_pos, | 795 const gfx::Rect& initial_pos, |
| 811 bool user_gesture) { | 796 bool user_gesture) { |
| 812 if (all_contents_blocked_) { | |
| 813 if (!blocked_contents_) | |
| 814 blocked_contents_ = new BlockedContentContainer(this); | |
| 815 blocked_contents_->AddTabContents( | |
| 816 new_contents, disposition, initial_pos, user_gesture); | |
| 817 return; | |
| 818 } | |
| 819 | |
| 820 if (!delegate_) | 797 if (!delegate_) |
| 821 return; | 798 return; |
| 822 | 799 |
| 823 if ((disposition == NEW_POPUP) && !user_gesture && | 800 delegate_->AddNewContents(this, new_contents, disposition, initial_pos, |
| 824 !CommandLine::ForCurrentProcess()->HasSwitch( | 801 user_gesture); |
| 825 switches::kDisablePopupBlocking)) { | |
| 826 // Unrequested popups from normal pages are constrained unless they're in | |
| 827 // the whitelist. The popup owner will handle checking this. | |
| 828 delegate_->GetConstrainingContents(this)->AddPopup( | |
| 829 new_contents, initial_pos); | |
| 830 } else { | |
| 831 new_contents->DisassociateFromPopupCount(); | |
| 832 delegate_->AddNewContents(this, new_contents, disposition, initial_pos, | |
| 833 user_gesture); | |
| 834 NotificationService::current()->Notify( | |
| 835 NotificationType::TAB_ADDED, | |
| 836 Source<TabContentsDelegate>(delegate_), | |
| 837 Details<TabContents>(this)); | |
| 838 } | |
| 839 | |
| 840 // TODO(pkasting): Why is this necessary? | |
| 841 PopupNotificationVisibilityChanged(blocked_contents_ != NULL); | |
| 842 } | |
| 843 | |
| 844 void TabContents::PopupNotificationVisibilityChanged(bool visible) { | |
| 845 if (is_being_destroyed_) | |
| 846 return; | |
| 847 content_settings_delegate_->SetPopupsBlocked(visible); | |
| 848 if (!dont_notify_render_view_) | |
| 849 render_view_host()->AllowScriptToClose(!visible); | |
| 850 } | 802 } |
| 851 | 803 |
| 852 gfx::NativeView TabContents::GetContentNativeView() const { | 804 gfx::NativeView TabContents::GetContentNativeView() const { |
| 853 return view_->GetContentNativeView(); | 805 return view_->GetContentNativeView(); |
| 854 } | 806 } |
| 855 | 807 |
| 856 gfx::NativeView TabContents::GetNativeView() const { | 808 gfx::NativeView TabContents::GetNativeView() const { |
| 857 return view_->GetNativeView(); | 809 return view_->GetNativeView(); |
| 858 } | 810 } |
| 859 | 811 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 child_windows_.erase(i); | 983 child_windows_.erase(i); |
| 1032 if (child_windows_.empty()) { | 984 if (child_windows_.empty()) { |
| 1033 BlockTabContent(false); | 985 BlockTabContent(false); |
| 1034 } else { | 986 } else { |
| 1035 if (removed_topmost_window) | 987 if (removed_topmost_window) |
| 1036 child_windows_[0]->ShowConstrainedWindow(); | 988 child_windows_[0]->ShowConstrainedWindow(); |
| 1037 BlockTabContent(true); | 989 BlockTabContent(true); |
| 1038 } | 990 } |
| 1039 } | 991 } |
| 1040 | 992 |
| 1041 void TabContents::WillCloseBlockedContentContainer( | |
| 1042 BlockedContentContainer* container) { | |
| 1043 DCHECK(blocked_contents_ == container); | |
| 1044 blocked_contents_ = NULL; | |
| 1045 PopupNotificationVisibilityChanged(false); | |
| 1046 } | |
| 1047 | |
| 1048 void TabContents::EmailPageLocation() { | 993 void TabContents::EmailPageLocation() { |
| 1049 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); | 994 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); |
| 1050 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); | 995 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); |
| 1051 std::string mailto = std::string("mailto:?subject=Fwd:%20") + | 996 std::string mailto = std::string("mailto:?subject=Fwd:%20") + |
| 1052 title + "&body=%0A%0A" + page_url; | 997 title + "&body=%0A%0A" + page_url; |
| 1053 platform_util::OpenExternal(GURL(mailto)); | 998 platform_util::OpenExternal(GURL(mailto)); |
| 1054 } | 999 } |
| 1055 | 1000 |
| 1056 bool TabContents::PrintNow() { | 1001 bool TabContents::PrintNow() { |
| 1057 // We can't print interstitial page for now. | 1002 // We can't print interstitial page for now. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1075 | 1020 |
| 1076 void TabContents::ResetOverrideEncoding() { | 1021 void TabContents::ResetOverrideEncoding() { |
| 1077 reset_encoding(); | 1022 reset_encoding(); |
| 1078 render_view_host()->ResetPageEncodingToDefault(); | 1023 render_view_host()->ResetPageEncodingToDefault(); |
| 1079 } | 1024 } |
| 1080 | 1025 |
| 1081 void TabContents::WindowMoveOrResizeStarted() { | 1026 void TabContents::WindowMoveOrResizeStarted() { |
| 1082 render_view_host()->WindowMoveOrResizeStarted(); | 1027 render_view_host()->WindowMoveOrResizeStarted(); |
| 1083 } | 1028 } |
| 1084 | 1029 |
| 1085 void TabContents::SetAllContentsBlocked(bool value) { | |
| 1086 if (all_contents_blocked_ == value) | |
| 1087 return; | |
| 1088 | |
| 1089 all_contents_blocked_ = value; | |
| 1090 if (!all_contents_blocked_ && blocked_contents_) { | |
| 1091 std::vector<TabContents*> blocked; | |
| 1092 blocked_contents_->GetBlockedContents(&blocked); | |
| 1093 for (size_t i = 0; i < blocked.size(); ++i) | |
| 1094 blocked_contents_->LaunchForContents(blocked[i]); | |
| 1095 } | |
| 1096 } | |
| 1097 | |
| 1098 void TabContents::LogNewTabTime(const std::string& event_name) { | 1030 void TabContents::LogNewTabTime(const std::string& event_name) { |
| 1099 // Not all new tab pages get timed. In those cases, we don't have a | 1031 // Not all new tab pages get timed. In those cases, we don't have a |
| 1100 // new_tab_start_time_. | 1032 // new_tab_start_time_. |
| 1101 if (new_tab_start_time_.is_null()) | 1033 if (new_tab_start_time_.is_null()) |
| 1102 return; | 1034 return; |
| 1103 | 1035 |
| 1104 base::TimeDelta duration = base::TimeTicks::Now() - new_tab_start_time_; | 1036 base::TimeDelta duration = base::TimeTicks::Now() - new_tab_start_time_; |
| 1105 MetricEventDurationDetails details(event_name, | 1037 MetricEventDurationDetails details(event_name, |
| 1106 static_cast<int>(duration.InMilliseconds())); | 1038 static_cast<int>(duration.InMilliseconds())); |
| 1107 | 1039 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 NotificationType type = is_loading ? NotificationType::LOAD_START : | 1340 NotificationType type = is_loading ? NotificationType::LOAD_START : |
| 1409 NotificationType::LOAD_STOP; | 1341 NotificationType::LOAD_STOP; |
| 1410 NotificationDetails det = NotificationService::NoDetails(); | 1342 NotificationDetails det = NotificationService::NoDetails(); |
| 1411 if (details) | 1343 if (details) |
| 1412 det = Details<LoadNotificationDetails>(details); | 1344 det = Details<LoadNotificationDetails>(details); |
| 1413 NotificationService::current()->Notify(type, | 1345 NotificationService::current()->Notify(type, |
| 1414 Source<NavigationController>(&controller_), | 1346 Source<NavigationController>(&controller_), |
| 1415 det); | 1347 det); |
| 1416 } | 1348 } |
| 1417 | 1349 |
| 1418 void TabContents::AddPopup(TabContents* new_contents, | |
| 1419 const gfx::Rect& initial_pos) { | |
| 1420 // A page can't spawn popups (or do anything else, either) until its load | |
| 1421 // commits, so when we reach here, the popup was spawned by the | |
| 1422 // NavigationController's last committed entry, not the active entry. For | |
| 1423 // example, if a page opens a popup in an onunload() handler, then the active | |
| 1424 // entry is the page to be loaded as we navigate away from the unloading | |
| 1425 // page. For this reason, we can't use GetURL() to get the opener URL, | |
| 1426 // because it returns the active entry. | |
| 1427 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | |
| 1428 GURL creator = entry ? entry->virtual_url() : GURL::EmptyGURL(); | |
| 1429 | |
| 1430 if (creator.is_valid() && | |
| 1431 profile()->GetHostContentSettingsMap()->GetContentSetting( | |
| 1432 creator, CONTENT_SETTINGS_TYPE_POPUPS, "") == CONTENT_SETTING_ALLOW) { | |
| 1433 AddNewContents(new_contents, NEW_POPUP, initial_pos, true); | |
| 1434 } else { | |
| 1435 if (!blocked_contents_) | |
| 1436 blocked_contents_ = new BlockedContentContainer(this); | |
| 1437 blocked_contents_->AddTabContents(new_contents, NEW_POPUP, initial_pos, | |
| 1438 true); | |
| 1439 content_settings_delegate_->OnContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS, | |
| 1440 std::string()); | |
| 1441 } | |
| 1442 } | |
| 1443 | |
| 1444 void TabContents::ExpireInfoBars( | 1350 void TabContents::ExpireInfoBars( |
| 1445 const NavigationController::LoadCommittedDetails& details) { | 1351 const NavigationController::LoadCommittedDetails& details) { |
| 1446 // Only hide InfoBars when the user has done something that makes the main | 1352 // Only hide InfoBars when the user has done something that makes the main |
| 1447 // frame load. We don't want various automatic or subframe navigations making | 1353 // frame load. We don't want various automatic or subframe navigations making |
| 1448 // it disappear. | 1354 // it disappear. |
| 1449 if (!details.is_user_initiated_main_frame_load()) | 1355 if (!details.is_user_initiated_main_frame_load()) |
| 1450 return; | 1356 return; |
| 1451 | 1357 |
| 1452 // NOTE: It is not safe to change the following code to count upwards or use | 1358 // NOTE: It is not safe to change the following code to count upwards or use |
| 1453 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate | 1359 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 | 1443 |
| 1538 // Get the favicon, either from history or request it from the net. | 1444 // Get the favicon, either from history or request it from the net. |
| 1539 favicon_helper_->FetchFavicon(details.entry->url()); | 1445 favicon_helper_->FetchFavicon(details.entry->url()); |
| 1540 | 1446 |
| 1541 if (touch_icon_helper_.get()) | 1447 if (touch_icon_helper_.get()) |
| 1542 touch_icon_helper_->FetchFavicon(details.entry->url()); | 1448 touch_icon_helper_->FetchFavicon(details.entry->url()); |
| 1543 | 1449 |
| 1544 // Clear all page actions, blocked content notifications and browser actions | 1450 // Clear all page actions, blocked content notifications and browser actions |
| 1545 // for this tab, unless this is an in-page navigation. | 1451 // for this tab, unless this is an in-page navigation. |
| 1546 if (!details.is_in_page) { | 1452 if (!details.is_in_page) { |
| 1547 // Close blocked popups. | |
| 1548 if (blocked_contents_) { | |
| 1549 AutoReset<bool> auto_reset(&dont_notify_render_view_, true); | |
| 1550 blocked_contents_->Destroy(); | |
| 1551 blocked_contents_ = NULL; | |
| 1552 } | |
| 1553 | |
| 1554 // Clear "blocked" flags. | 1453 // Clear "blocked" flags. |
| 1555 content_settings_delegate_->ClearBlockedContentSettingsExceptForCookies(); | 1454 content_settings_delegate_->ClearBlockedContentSettingsExceptForCookies(); |
| 1556 content_settings_delegate_->GeolocationDidNavigate(details); | 1455 content_settings_delegate_->GeolocationDidNavigate(details); |
| 1557 | 1456 |
| 1558 // Once the main frame is navigated, we're no longer considered to have | 1457 // Once the main frame is navigated, we're no longer considered to have |
| 1559 // displayed insecure content. | 1458 // displayed insecure content. |
| 1560 displayed_insecure_content_ = false; | 1459 displayed_insecure_content_ = false; |
| 1561 } | 1460 } |
| 1562 | 1461 |
| 1563 // Close constrained windows if necessary. | 1462 // Close constrained windows if necessary. |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 &renderer_preferences_, profile()); | 2363 &renderer_preferences_, profile()); |
| 2465 render_view_host()->SyncRendererPrefs(); | 2364 render_view_host()->SyncRendererPrefs(); |
| 2466 break; | 2365 break; |
| 2467 } | 2366 } |
| 2468 #endif | 2367 #endif |
| 2469 | 2368 |
| 2470 case NotificationType::USER_STYLE_SHEET_UPDATED: | 2369 case NotificationType::USER_STYLE_SHEET_UPDATED: |
| 2471 UpdateWebPreferences(); | 2370 UpdateWebPreferences(); |
| 2472 break; | 2371 break; |
| 2473 | 2372 |
| 2474 case NotificationType::CONTENT_SETTINGS_CHANGED: { | |
| 2475 Details<const ContentSettingsDetails> settings_details(details); | |
| 2476 NavigationEntry* entry = controller_.GetActiveEntry(); | |
| 2477 GURL entry_url; | |
| 2478 if (entry) | |
| 2479 entry_url = entry->url(); | |
| 2480 if (settings_details.ptr()->update_all() || | |
| 2481 settings_details.ptr()->pattern().Matches(entry_url)) { | |
| 2482 render_view_host()->SendContentSettings(entry_url, | |
| 2483 profile()->GetHostContentSettingsMap()-> | |
| 2484 GetContentSettings(entry_url)); | |
| 2485 } | |
| 2486 break; | |
| 2487 } | |
| 2488 | |
| 2489 case NotificationType::GOOGLE_URL_UPDATED: | 2373 case NotificationType::GOOGLE_URL_UPDATED: |
| 2490 UpdateAlternateErrorPageURL(); | 2374 UpdateAlternateErrorPageURL(); |
| 2491 break; | 2375 break; |
| 2492 | 2376 |
| 2493 default: | 2377 default: |
| 2494 NOTREACHED(); | 2378 NOTREACHED(); |
| 2495 } | 2379 } |
| 2496 } | 2380 } |
| 2497 | 2381 |
| 2498 gfx::NativeWindow TabContents::GetMessageBoxRootWindow() { | 2382 gfx::NativeWindow TabContents::GetMessageBoxRootWindow() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2536 | 2420 |
| 2537 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2421 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2538 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2422 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2539 rwh_view->SetSize(view()->GetContainerSize()); | 2423 rwh_view->SetSize(view()->GetContainerSize()); |
| 2540 } | 2424 } |
| 2541 | 2425 |
| 2542 void TabContents::OnOnlineStateChanged(bool online) { | 2426 void TabContents::OnOnlineStateChanged(bool online) { |
| 2543 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2427 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2544 render_view_host()->routing_id(), online)); | 2428 render_view_host()->routing_id(), online)); |
| 2545 } | 2429 } |
| OLD | NEW |