OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "app/text_elider.h" | 9 #include "app/text_elider.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/i18n/rtl.h" |
12 #include "base/process_util.h" | 13 #include "base/process_util.h" |
13 #include "base/string16.h" | 14 #include "base/string16.h" |
14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
15 #include "base/time.h" | 16 #include "base/time.h" |
16 #include "chrome/browser/autocomplete_history_manager.h" | 17 #include "chrome/browser/autocomplete_history_manager.h" |
17 #include "chrome/browser/autofill/autofill_manager.h" | 18 #include "chrome/browser/autofill/autofill_manager.h" |
18 #include "chrome/browser/blocked_popup_container.h" | 19 #include "chrome/browser/blocked_popup_container.h" |
19 #include "chrome/browser/bookmarks/bookmark_model.h" | 20 #include "chrome/browser/bookmarks/bookmark_model.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/browser_shutdown.h" | 22 #include "chrome/browser/browser_shutdown.h" |
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2848 replacements.ClearPath(); | 2849 replacements.ClearPath(); |
2849 replacements.ClearQuery(); | 2850 replacements.ClearQuery(); |
2850 replacements.ClearRef(); | 2851 replacements.ClearRef(); |
2851 GURL clean_url = frame_url.ReplaceComponents(replacements); | 2852 GURL clean_url = frame_url.ReplaceComponents(replacements); |
2852 | 2853 |
2853 // TODO(brettw) it should be easier than this to do the correct language | 2854 // TODO(brettw) it should be easier than this to do the correct language |
2854 // handling without getting the accept language from the profile. | 2855 // handling without getting the accept language from the profile. |
2855 std::wstring base_address = gfx::ElideUrl(clean_url, gfx::Font(), 0, | 2856 std::wstring base_address = gfx::ElideUrl(clean_url, gfx::Font(), 0, |
2856 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 2857 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
2857 // Force URL to have LTR directionality. | 2858 // Force URL to have LTR directionality. |
2858 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 2859 if (base::i18n::IsRTL()) |
2859 l10n_util::WrapStringWithLTRFormatting(&base_address); | 2860 base::i18n::WrapStringWithLTRFormatting(&base_address); |
2860 | 2861 |
2861 return l10n_util::GetStringF( | 2862 return l10n_util::GetStringF( |
2862 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE : IDS_JAVASCRIPT_MESSAGEBOX_TITLE, | 2863 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE : IDS_JAVASCRIPT_MESSAGEBOX_TITLE, |
2863 base_address); | 2864 base_address); |
2864 } | 2865 } |
2865 | 2866 |
2866 gfx::NativeWindow TabContents::GetMessageBoxRootWindow() { | 2867 gfx::NativeWindow TabContents::GetMessageBoxRootWindow() { |
2867 return view_->GetTopLevelNativeWindow(); | 2868 return view_->GetTopLevelNativeWindow(); |
2868 } | 2869 } |
2869 | 2870 |
(...skipping 17 matching lines...) Expand all Loading... |
2887 } | 2888 } |
2888 | 2889 |
2889 void TabContents::set_encoding(const std::string& encoding) { | 2890 void TabContents::set_encoding(const std::string& encoding) { |
2890 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2891 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2891 } | 2892 } |
2892 | 2893 |
2893 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 2894 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
2894 app_icon_ = app_icon; | 2895 app_icon_ = app_icon; |
2895 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 2896 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
2896 } | 2897 } |
OLD | NEW |