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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); | 840 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); |
837 if (rwhv) { | 841 if (rwhv) { |
838 rwhv->DidBecomeSelected(); | 842 rwhv->DidBecomeSelected(); |
839 #if defined(OS_MACOSX) | 843 #if defined(OS_MACOSX) |
840 rwhv->SetActive(true); | 844 rwhv->SetActive(true); |
841 #endif | 845 #endif |
842 } | 846 } |
843 | 847 |
844 WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id()); | 848 WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id()); |
845 last_selected_time_ = base::TimeTicks::Now(); | 849 last_selected_time_ = base::TimeTicks::Now(); |
| 850 #if defined(OS_CHROMEOS) |
| 851 chromeos::LocaleChangeGuard::Check(this); |
| 852 #endif |
846 } | 853 } |
847 | 854 |
848 void TabContents::FadeForInstant(bool animate) { | 855 void TabContents::FadeForInstant(bool animate) { |
849 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); | 856 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); |
850 SkColor whitish = SkColorSetARGB(192, 255, 255, 255); | 857 SkColor whitish = SkColorSetARGB(192, 255, 255, 255); |
851 if (rwhv) | 858 if (rwhv) |
852 rwhv->SetVisuallyDeemphasized(&whitish, animate); | 859 rwhv->SetVisuallyDeemphasized(&whitish, animate); |
853 } | 860 } |
854 | 861 |
855 void TabContents::CancelInstantFade() { | 862 void TabContents::CancelInstantFade() { |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 DidNavigateAnyFramePostCommit(details, params)); | 1996 DidNavigateAnyFramePostCommit(details, params)); |
1990 | 1997 |
1991 // Let the LanguageState clear its state. | 1998 // Let the LanguageState clear its state. |
1992 language_state_.DidNavigate(details); | 1999 language_state_.DidNavigate(details); |
1993 } | 2000 } |
1994 | 2001 |
1995 void TabContents::CloseConstrainedWindows() { | 2002 void TabContents::CloseConstrainedWindows() { |
1996 // Clear out any constrained windows since we are leaving this page entirely. | 2003 // Clear out any constrained windows since we are leaving this page entirely. |
1997 // We use indices instead of iterators in case CloseWindow does something | 2004 // We use indices instead of iterators in case CloseWindow does something |
1998 // that may invalidate an iterator. | 2005 // that may invalidate an iterator. |
1999 int size = static_cast<int>(child_windows_.size()); | 2006 for (size_t i = 0; i < child_windows_.size(); ++i) { |
2000 for (int i = size - 1; i >= 0; --i) { | 2007 ConstrainedWindow* window = child_windows_[child_windows_.size() - 1 - i]; |
2001 ConstrainedWindow* window = child_windows_[i]; | |
2002 if (window) { | 2008 if (window) { |
2003 window->CloseConstrainedWindow(); | 2009 window->CloseConstrainedWindow(); |
2004 BlockTabContent(false); | 2010 BlockTabContent(false); |
2005 } | 2011 } |
2006 } | 2012 } |
2007 } | 2013 } |
2008 | 2014 |
2009 void TabContents::UpdateStarredStateForCurrentURL() { | 2015 void TabContents::UpdateStarredStateForCurrentURL() { |
2010 BookmarkModel* model = profile()->GetBookmarkModel(); | 2016 BookmarkModel* model = profile()->GetBookmarkModel(); |
2011 const bool old_state = is_starred_; | 2017 const bool old_state = is_starred_; |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 } | 3378 } |
3373 | 3379 |
3374 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3380 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3375 render_manager_.SwapInRenderViewHost(rvh); | 3381 render_manager_.SwapInRenderViewHost(rvh); |
3376 } | 3382 } |
3377 | 3383 |
3378 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3384 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3379 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3385 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3380 rwh_view->SetSize(view()->GetContainerSize()); | 3386 rwh_view->SetSize(view()->GetContainerSize()); |
3381 } | 3387 } |
OLD | NEW |