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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 #include "chrome/browser/renderer_host/site_instance.h" | 63 #include "chrome/browser/renderer_host/site_instance.h" |
64 #include "chrome/browser/renderer_host/web_cache_manager.h" | 64 #include "chrome/browser/renderer_host/web_cache_manager.h" |
65 #include "chrome/browser/renderer_preferences_util.h" | 65 #include "chrome/browser/renderer_preferences_util.h" |
66 #include "chrome/browser/search_engines/template_url.h" | 66 #include "chrome/browser/search_engines/template_url.h" |
67 #include "chrome/browser/search_engines/template_url_fetcher.h" | 67 #include "chrome/browser/search_engines/template_url_fetcher.h" |
68 #include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h" | 68 #include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h" |
69 #include "chrome/browser/search_engines/template_url_model.h" | 69 #include "chrome/browser/search_engines/template_url_model.h" |
70 #include "chrome/browser/sessions/session_types.h" | 70 #include "chrome/browser/sessions/session_types.h" |
71 #include "chrome/browser/tab_contents/infobar_delegate.h" | 71 #include "chrome/browser/tab_contents/infobar_delegate.h" |
72 #include "chrome/browser/tab_contents/interstitial_page.h" | 72 #include "chrome/browser/tab_contents/interstitial_page.h" |
73 #include "chrome/browser/tab_contents/locale_change_guard.h" | |
73 #include "chrome/browser/tab_contents/navigation_entry.h" | 74 #include "chrome/browser/tab_contents/navigation_entry.h" |
74 #include "chrome/browser/tab_contents/provisional_load_details.h" | 75 #include "chrome/browser/tab_contents/provisional_load_details.h" |
75 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 76 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
76 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 77 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
77 #include "chrome/browser/tab_contents/tab_contents_view.h" | 78 #include "chrome/browser/tab_contents/tab_contents_view.h" |
78 #include "chrome/browser/tab_contents/web_navigation_observer.h" | 79 #include "chrome/browser/tab_contents/web_navigation_observer.h" |
79 #include "chrome/browser/translate/page_translated_details.h" | 80 #include "chrome/browser/translate/page_translated_details.h" |
80 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 81 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
81 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 82 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
82 #include "chrome/common/bindings_policy.h" | 83 #include "chrome/common/bindings_policy.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
827 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); | 828 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); |
828 if (rwhv) { | 829 if (rwhv) { |
829 rwhv->DidBecomeSelected(); | 830 rwhv->DidBecomeSelected(); |
830 #if defined(OS_MACOSX) | 831 #if defined(OS_MACOSX) |
831 rwhv->SetActive(true); | 832 rwhv->SetActive(true); |
832 #endif | 833 #endif |
833 } | 834 } |
834 | 835 |
835 WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id()); | 836 WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id()); |
836 last_selected_time_ = base::TimeTicks::Now(); | 837 last_selected_time_ = base::TimeTicks::Now(); |
838 #if defined(OS_CHROMEOS) | |
whywhat
2011/01/11 10:24:14
If we have ifdef here why do all this stuff with L
Denis Lagno
2011/01/12 15:33:28
my first impression was that this stuff is not ver
| |
839 LocaleChangeGuard::Check(this); | |
840 #endif | |
837 } | 841 } |
838 | 842 |
839 void TabContents::FadeForInstant(bool animate) { | 843 void TabContents::FadeForInstant(bool animate) { |
840 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); | 844 RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); |
841 SkColor whitish = SkColorSetARGB(192, 255, 255, 255); | 845 SkColor whitish = SkColorSetARGB(192, 255, 255, 255); |
842 if (rwhv) | 846 if (rwhv) |
843 rwhv->SetVisuallyDeemphasized(&whitish, animate); | 847 rwhv->SetVisuallyDeemphasized(&whitish, animate); |
844 } | 848 } |
845 | 849 |
846 void TabContents::CancelInstantFade() { | 850 void TabContents::CancelInstantFade() { |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1978 // Notify observers about navigation. | 1982 // Notify observers about navigation. |
1979 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, | 1983 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, |
1980 DidNavigateAnyFramePostCommit(details, params)); | 1984 DidNavigateAnyFramePostCommit(details, params)); |
1981 | 1985 |
1982 // Let the LanguageState clear its state. | 1986 // Let the LanguageState clear its state. |
1983 language_state_.DidNavigate(details); | 1987 language_state_.DidNavigate(details); |
1984 } | 1988 } |
1985 | 1989 |
1986 void TabContents::CloseConstrainedWindows() { | 1990 void TabContents::CloseConstrainedWindows() { |
1987 // Clear out any constrained windows since we are leaving this page entirely. | 1991 // Clear out any constrained windows since we are leaving this page entirely. |
1988 // We use indices instead of iterators in case CloseWindow does something | 1992 // We use indices instead of iterators in case CloseWindow does something |
whywhat
2011/01/11 10:24:14
Don't see how this could happen unless a) there's
Denis Lagno
2011/01/12 15:33:28
Disclaimer: this is not my code so below is just a
| |
1989 // that may invalidate an iterator. | 1993 // that may invalidate an iterator. |
1990 int size = static_cast<int>(child_windows_.size()); | 1994 for (size_t i = child_windows_.size(); i--;) { |
whywhat
2011/01/11 10:24:14
Why not do a loop from 0 to size() or, if it was a
Denis Lagno
2011/01/12 15:33:28
why loop in reverse order -- speculated above.
as
| |
1991 for (int i = size - 1; i >= 0; --i) { | |
1992 ConstrainedWindow* window = child_windows_[i]; | 1995 ConstrainedWindow* window = child_windows_[i]; |
1993 if (window) { | 1996 if (window) { |
1994 window->CloseConstrainedWindow(); | 1997 window->CloseConstrainedWindow(); |
1995 BlockTabContent(false); | 1998 BlockTabContent(false); |
1996 } | 1999 } |
1997 } | 2000 } |
1998 } | 2001 } |
1999 | 2002 |
2000 void TabContents::UpdateStarredStateForCurrentURL() { | 2003 void TabContents::UpdateStarredStateForCurrentURL() { |
2001 BookmarkModel* model = profile()->GetBookmarkModel(); | 2004 BookmarkModel* model = profile()->GetBookmarkModel(); |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3363 } | 3366 } |
3364 | 3367 |
3365 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3368 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3366 render_manager_.SwapInRenderViewHost(rvh); | 3369 render_manager_.SwapInRenderViewHost(rvh); |
3367 } | 3370 } |
3368 | 3371 |
3369 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3372 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3370 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3373 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3371 rwh_view->SetSize(view()->GetContainerSize()); | 3374 rwh_view->SetSize(view()->GetContainerSize()); |
3372 } | 3375 } |
OLD | NEW |