OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/web_contents.h" | 5 #include "chrome/browser/web_contents.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "chrome/app/locales/locale_settings.h" | 9 #include "chrome/app/locales/locale_settings.h" |
10 #include "chrome/browser/bookmarks/bookmark_bar_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/cache_manager_host.h" | 12 #include "chrome/browser/cache_manager_host.h" |
13 #include "chrome/browser/character_encoding.h" | 13 #include "chrome/browser/character_encoding.h" |
14 #include "chrome/browser/dom_operation_notification_details.h" | 14 #include "chrome/browser/dom_operation_notification_details.h" |
15 #include "chrome/browser/download_manager.h" | 15 #include "chrome/browser/download_manager.h" |
16 #include "chrome/browser/find_in_page_controller.h" | 16 #include "chrome/browser/find_in_page_controller.h" |
17 #include "chrome/browser/find_notification_details.h" | 17 #include "chrome/browser/find_notification_details.h" |
18 #include "chrome/browser/google_util.h" | 18 #include "chrome/browser/google_util.h" |
19 #include "chrome/browser/interstitial_page_delegate.h" | 19 #include "chrome/browser/interstitial_page_delegate.h" |
20 #include "chrome/browser/js_before_unload_handler.h" | 20 #include "chrome/browser/js_before_unload_handler.h" |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 last_javascript_message_dismissal_ = TimeTicks::Now(); | 739 last_javascript_message_dismissal_ = TimeTicks::Now(); |
740 render_manager_.OnJavaScriptMessageBoxClosed(reply_msg, success, prompt); | 740 render_manager_.OnJavaScriptMessageBoxClosed(reply_msg, success, prompt); |
741 } | 741 } |
742 | 742 |
743 // Generic NotificationObserver callback. | 743 // Generic NotificationObserver callback. |
744 void WebContents::Observe(NotificationType type, | 744 void WebContents::Observe(NotificationType type, |
745 const NotificationSource& source, | 745 const NotificationSource& source, |
746 const NotificationDetails& details) { | 746 const NotificationDetails& details) { |
747 TabContents::Observe(type, source, details); | 747 TabContents::Observe(type, source, details); |
748 switch (type) { | 748 switch (type) { |
749 case NOTIFY_BOOKMARK_MODEL_LOADED: // BookmarkBarModel finished loading, | 749 case NOTIFY_BOOKMARK_MODEL_LOADED: // BookmarkModel finished loading, fall |
750 // fall through to update starred state. | 750 // through to update starred state. |
751 case NOTIFY_URLS_STARRED: { // Somewhere, a URL has been starred. | 751 case NOTIFY_URLS_STARRED: { // Somewhere, a URL has been starred. |
752 // Ignore notifications for profiles other than our current one. | 752 // Ignore notifications for profiles other than our current one. |
753 Profile* source_profile = Source<Profile>(source).ptr(); | 753 Profile* source_profile = Source<Profile>(source).ptr(); |
754 if (!source_profile->IsSameProfile(profile())) | 754 if (!source_profile->IsSameProfile(profile())) |
755 return; | 755 return; |
756 | 756 |
757 UpdateStarredStateForCurrentURL(); | 757 UpdateStarredStateForCurrentURL(); |
758 break; | 758 break; |
759 } | 759 } |
760 case NOTIFY_PREF_CHANGED: { | 760 case NOTIFY_PREF_CHANGED: { |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 render_manager_.IsRenderViewInterstitial(render_view_host), | 1453 render_manager_.IsRenderViewInterstitial(render_view_host), |
1454 IsInPageNavigation(params.url), | 1454 IsInPageNavigation(params.url), |
1455 params.url, params.security_info); | 1455 params.url, params.security_info); |
1456 NotificationService::current()-> | 1456 NotificationService::current()-> |
1457 Notify(NOTIFY_FRAME_PROVISIONAL_LOAD_COMMITTED, | 1457 Notify(NOTIFY_FRAME_PROVISIONAL_LOAD_COMMITTED, |
1458 Source<NavigationController>(controller()), | 1458 Source<NavigationController>(controller()), |
1459 Details<ProvisionalLoadDetails>(&details)); | 1459 Details<ProvisionalLoadDetails>(&details)); |
1460 } | 1460 } |
1461 | 1461 |
1462 void WebContents::UpdateStarredStateForCurrentURL() { | 1462 void WebContents::UpdateStarredStateForCurrentURL() { |
1463 BookmarkBarModel* model = profile()->GetBookmarkBarModel(); | 1463 BookmarkModel* model = profile()->GetBookmarkModel(); |
1464 const bool old_state = is_starred_; | 1464 const bool old_state = is_starred_; |
1465 is_starred_ = (model && model->GetNodeByURL(GetURL())); | 1465 is_starred_ = (model && model->GetNodeByURL(GetURL())); |
1466 | 1466 |
1467 if (is_starred_ != old_state && delegate()) | 1467 if (is_starred_ != old_state && delegate()) |
1468 delegate()->URLStarredChanged(this, is_starred_); | 1468 delegate()->URLStarredChanged(this, is_starred_); |
1469 } | 1469 } |
1470 | 1470 |
1471 void WebContents::UpdateAlternateErrorPageURL() { | 1471 void WebContents::UpdateAlternateErrorPageURL() { |
1472 GURL url = GetAlternateErrorPageURL(); | 1472 GURL url = GetAlternateErrorPageURL(); |
1473 render_view_host()->SetAlternateErrorPageURL(url); | 1473 render_view_host()->SetAlternateErrorPageURL(url); |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 | 2583 |
2584 BOOL WebContents::EnumPluginWindowsCallback(HWND window, LPARAM) { | 2584 BOOL WebContents::EnumPluginWindowsCallback(HWND window, LPARAM) { |
2585 if (WebPluginDelegateImpl::IsPluginDelegateWindow(window)) { | 2585 if (WebPluginDelegateImpl::IsPluginDelegateWindow(window)) { |
2586 ::ShowWindow(window, SW_HIDE); | 2586 ::ShowWindow(window, SW_HIDE); |
2587 SetParent(window, NULL); | 2587 SetParent(window, NULL); |
2588 } | 2588 } |
2589 | 2589 |
2590 return TRUE; | 2590 return TRUE; |
2591 } | 2591 } |
2592 | 2592 |
OLD | NEW |