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" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "chrome/browser/autocomplete_history_manager.h" | 18 #include "chrome/browser/autocomplete_history_manager.h" |
19 #include "chrome/browser/autofill/autofill_manager.h" | 19 #include "chrome/browser/autofill/autofill_manager.h" |
20 #include "chrome/browser/blocked_content_container.h" | 20 #include "chrome/browser/blocked_content_container.h" |
21 #include "chrome/browser/bookmarks/bookmark_model.h" | 21 #include "chrome/browser/bookmarks/bookmark_model.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/browser_shutdown.h" | 23 #include "chrome/browser/browser_shutdown.h" |
24 #include "chrome/browser/character_encoding.h" | 24 #include "chrome/browser/character_encoding.h" |
25 #include "chrome/browser/child_process_security_policy.h" | 25 #include "chrome/browser/child_process_security_policy.h" |
26 #include "chrome/browser/chromeos/locale_change_guard.h" | |
26 #include "chrome/browser/content_settings/content_settings_details.h" | 27 #include "chrome/browser/content_settings/content_settings_details.h" |
27 #include "chrome/browser/content_settings/host_content_settings_map.h" | 28 #include "chrome/browser/content_settings/host_content_settings_map.h" |
28 #include "chrome/browser/debugger/devtools_manager.h" | 29 #include "chrome/browser/debugger/devtools_manager.h" |
29 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
30 #include "chrome/browser/dom_operation_notification_details.h" | 31 #include "chrome/browser/dom_operation_notification_details.h" |
31 #include "chrome/browser/dom_ui/dom_ui.h" | 32 #include "chrome/browser/dom_ui/dom_ui.h" |
32 #include "chrome/browser/download/download_item_model.h" | 33 #include "chrome/browser/download/download_item_model.h" |
33 #include "chrome/browser/download/download_manager.h" | 34 #include "chrome/browser/download/download_manager.h" |
34 #include "chrome/browser/download/download_request_limiter.h" | 35 #include "chrome/browser/download/download_request_limiter.h" |
35 #include "chrome/browser/extensions/extension_service.h" | 36 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 791 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) | |
839 chromeos::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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
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/12 16:33:16
I guess I'd run i from 0 to child_windows_.size()
Denis Lagno
2011/01/12 20:27:34
I've changed the loop.
However I fear to add comme
whywhat
2011/01/13 10:09:43
Yet, you don't fear to change the code itself like
| |
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 |