| OLD | NEW |
| 1 // Copyright (c) 2010 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" |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 #include "net/base/registry_controlled_domain.h" | 104 #include "net/base/registry_controlled_domain.h" |
| 105 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 105 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 106 #include "webkit/glue/password_form.h" | 106 #include "webkit/glue/password_form.h" |
| 107 #include "webkit/plugins/npapi/plugin_list.h" | 107 #include "webkit/plugins/npapi/plugin_list.h" |
| 108 #include "webkit/glue/webpreferences.h" | 108 #include "webkit/glue/webpreferences.h" |
| 109 | 109 |
| 110 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
| 111 #include "app/surface/io_surface_support_mac.h" | 111 #include "app/surface/io_surface_support_mac.h" |
| 112 #endif // defined(OS_MACOSX) | 112 #endif // defined(OS_MACOSX) |
| 113 | 113 |
| 114 #if defined(OS_CHROMEOS) |
| 115 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 116 #endif // defined(OS_CHROMEOS) |
| 117 |
| 114 // Cross-Site Navigations | 118 // Cross-Site Navigations |
| 115 // | 119 // |
| 116 // If a TabContents is told to navigate to a different web site (as determined | 120 // If a TabContents is told to navigate to a different web site (as determined |
| 117 // by SiteInstance), it will replace its current RenderViewHost with a new | 121 // by SiteInstance), it will replace its current RenderViewHost with a new |
| 118 // RenderViewHost dedicated to the new SiteInstance. This works as follows: | 122 // RenderViewHost dedicated to the new SiteInstance. This works as follows: |
| 119 // | 123 // |
| 120 // - Navigate determines whether the destination is cross-site, and if so, | 124 // - Navigate determines whether the destination is cross-site, and if so, |
| 121 // it creates a pending_render_view_host_ and moves into the PENDING | 125 // it creates a pending_render_view_host_ and moves into the PENDING |
| 122 // RendererState. | 126 // RendererState. |
| 123 // - The pending RVH is "suspended," so that no navigation messages are sent to | 127 // - The pending RVH is "suspended," so that no navigation messages are sent to |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); | 831 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); |
| 828 if (rwhv) { | 832 if (rwhv) { |
| 829 rwhv->DidBecomeSelected(); | 833 rwhv->DidBecomeSelected(); |
| 830 #if defined(OS_MACOSX) | 834 #if defined(OS_MACOSX) |
| 831 rwhv->SetActive(true); | 835 rwhv->SetActive(true); |
| 832 #endif | 836 #endif |
| 833 } | 837 } |
| 834 | 838 |
| 835 WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id()); | 839 WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id()); |
| 836 last_selected_time_ = base::TimeTicks::Now(); | 840 last_selected_time_ = base::TimeTicks::Now(); |
| 841 #if defined(OS_CHROMEOS) |
| 842 chromeos::LocaleChangeGuard::Check(this); |
| 843 #endif |
| 837 } | 844 } |
| 838 | 845 |
| 839 void TabContents::FadeForInstant(bool animate) { | 846 void TabContents::FadeForInstant(bool animate) { |
| 840 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); | 847 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); |
| 841 SkColor whitish = SkColorSetARGB(192, 255, 255, 255); | 848 SkColor whitish = SkColorSetARGB(192, 255, 255, 255); |
| 842 if (rwhv) | 849 if (rwhv) |
| 843 rwhv->SetVisuallyDeemphasized(&whitish, animate); | 850 rwhv->SetVisuallyDeemphasized(&whitish, animate); |
| 844 } | 851 } |
| 845 | 852 |
| 846 void TabContents::CancelInstantFade() { | 853 void TabContents::CancelInstantFade() { |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1980 DidNavigateAnyFramePostCommit(details, params)); | 1987 DidNavigateAnyFramePostCommit(details, params)); |
| 1981 | 1988 |
| 1982 // Let the LanguageState clear its state. | 1989 // Let the LanguageState clear its state. |
| 1983 language_state_.DidNavigate(details); | 1990 language_state_.DidNavigate(details); |
| 1984 } | 1991 } |
| 1985 | 1992 |
| 1986 void TabContents::CloseConstrainedWindows() { | 1993 void TabContents::CloseConstrainedWindows() { |
| 1987 // Clear out any constrained windows since we are leaving this page entirely. | 1994 // Clear out any constrained windows since we are leaving this page entirely. |
| 1988 // We use indices instead of iterators in case CloseWindow does something | 1995 // We use indices instead of iterators in case CloseWindow does something |
| 1989 // that may invalidate an iterator. | 1996 // that may invalidate an iterator. |
| 1990 int size = static_cast<int>(child_windows_.size()); | 1997 for (size_t i = 0; i < child_windows_.size(); ++i) { |
| 1991 for (int i = size - 1; i >= 0; --i) { | 1998 ConstrainedWindow* window = child_windows_[child_windows_.size() - 1 - i]; |
| 1992 ConstrainedWindow* window = child_windows_[i]; | |
| 1993 if (window) { | 1999 if (window) { |
| 1994 window->CloseConstrainedWindow(); | 2000 window->CloseConstrainedWindow(); |
| 1995 BlockTabContent(false); | 2001 BlockTabContent(false); |
| 1996 } | 2002 } |
| 1997 } | 2003 } |
| 1998 } | 2004 } |
| 1999 | 2005 |
| 2000 void TabContents::UpdateStarredStateForCurrentURL() { | 2006 void TabContents::UpdateStarredStateForCurrentURL() { |
| 2001 BookmarkModel* model = profile()->GetBookmarkModel(); | 2007 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 2002 const bool old_state = is_starred_; | 2008 const bool old_state = is_starred_; |
| (...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3363 } | 3369 } |
| 3364 | 3370 |
| 3365 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3371 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 3366 render_manager_.SwapInRenderViewHost(rvh); | 3372 render_manager_.SwapInRenderViewHost(rvh); |
| 3367 } | 3373 } |
| 3368 | 3374 |
| 3369 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3375 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 3370 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3376 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 3371 rwh_view->SetSize(view()->GetContainerSize()); | 3377 rwh_view->SetSize(view()->GetContainerSize()); |
| 3372 } | 3378 } |
| OLD | NEW |