| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 prefs::kWebKitJavascriptCanOpenWindowsAutomatically, true); | 389 prefs::kWebKitJavascriptCanOpenWindowsAutomatically, true); |
| 390 prefs->RegisterBooleanPref(prefs::kWebKitLoadsImagesAutomatically, | 390 prefs->RegisterBooleanPref(prefs::kWebKitLoadsImagesAutomatically, |
| 391 pref_defaults.loads_images_automatically); | 391 pref_defaults.loads_images_automatically); |
| 392 prefs->RegisterBooleanPref(prefs::kWebKitPluginsEnabled, | 392 prefs->RegisterBooleanPref(prefs::kWebKitPluginsEnabled, |
| 393 pref_defaults.plugins_enabled); | 393 pref_defaults.plugins_enabled); |
| 394 prefs->RegisterBooleanPref(prefs::kWebKitDomPasteEnabled, | 394 prefs->RegisterBooleanPref(prefs::kWebKitDomPasteEnabled, |
| 395 pref_defaults.dom_paste_enabled); | 395 pref_defaults.dom_paste_enabled); |
| 396 prefs->RegisterBooleanPref(prefs::kWebKitShrinksStandaloneImagesToFit, | 396 prefs->RegisterBooleanPref(prefs::kWebKitShrinksStandaloneImagesToFit, |
| 397 pref_defaults.shrinks_standalone_images_to_fit); | 397 pref_defaults.shrinks_standalone_images_to_fit); |
| 398 prefs->RegisterStringPref(prefs::kWebKitInspectorSettings, | 398 prefs->RegisterStringPref(prefs::kWebKitInspectorSettings, |
| 399 pref_defaults.inspector_settings); | 399 UTF8ToWide(pref_defaults.inspector_settings)); |
| 400 prefs->RegisterBooleanPref(prefs::kWebKitTextAreasAreResizable, | 400 prefs->RegisterBooleanPref(prefs::kWebKitTextAreasAreResizable, |
| 401 pref_defaults.text_areas_are_resizable); | 401 pref_defaults.text_areas_are_resizable); |
| 402 prefs->RegisterBooleanPref(prefs::kWebKitJavaEnabled, | 402 prefs->RegisterBooleanPref(prefs::kWebKitJavaEnabled, |
| 403 pref_defaults.java_enabled); | 403 pref_defaults.java_enabled); |
| 404 | 404 |
| 405 prefs->RegisterLocalizedStringPref(prefs::kAcceptLanguages, | 405 prefs->RegisterLocalizedStringPref(prefs::kAcceptLanguages, |
| 406 IDS_ACCEPT_LANGUAGES); | 406 IDS_ACCEPT_LANGUAGES); |
| 407 prefs->RegisterLocalizedStringPref(prefs::kDefaultCharset, | 407 prefs->RegisterLocalizedStringPref(prefs::kDefaultCharset, |
| 408 IDS_DEFAULT_ENCODING); | 408 IDS_DEFAULT_ENCODING); |
| 409 prefs->RegisterLocalizedBooleanPref(prefs::kWebKitStandardFontIsSerif, | 409 prefs->RegisterLocalizedBooleanPref(prefs::kWebKitStandardFontIsSerif, |
| (...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 score, true); | 2092 score, true); |
| 2093 } else { | 2093 } else { |
| 2094 HistoryService* hs; | 2094 HistoryService* hs; |
| 2095 if (!profile()->IsOffTheRecord() && | 2095 if (!profile()->IsOffTheRecord() && |
| 2096 (hs = profile()->GetHistoryService(Profile::IMPLICIT_ACCESS))) { | 2096 (hs = profile()->GetHistoryService(Profile::IMPLICIT_ACCESS))) { |
| 2097 hs->SetPageThumbnail(url, bitmap, score); | 2097 hs->SetPageThumbnail(url, bitmap, score); |
| 2098 } | 2098 } |
| 2099 } | 2099 } |
| 2100 } | 2100 } |
| 2101 | 2101 |
| 2102 void TabContents::UpdateInspectorSettings(const std::wstring& raw_settings) { | 2102 void TabContents::UpdateInspectorSettings(const std::string& raw_settings) { |
| 2103 profile()->GetPrefs()->SetString(prefs::kWebKitInspectorSettings, | 2103 profile()->GetPrefs()->SetString(prefs::kWebKitInspectorSettings, |
| 2104 raw_settings); | 2104 UTF8ToWide(raw_settings)); |
| 2105 } | 2105 } |
| 2106 | 2106 |
| 2107 void TabContents::Close(RenderViewHost* rvh) { | 2107 void TabContents::Close(RenderViewHost* rvh) { |
| 2108 // If we close the tab while we're in the middle of a drag, we'll crash. | 2108 // If we close the tab while we're in the middle of a drag, we'll crash. |
| 2109 // Instead, cancel the drag and close it as soon as the drag ends. | 2109 // Instead, cancel the drag and close it as soon as the drag ends. |
| 2110 if (view()->IsDoingDrag()) { | 2110 if (view()->IsDoingDrag()) { |
| 2111 view()->CancelDragAndCloseTab(); | 2111 view()->CancelDragAndCloseTab(); |
| 2112 return; | 2112 return; |
| 2113 } | 2113 } |
| 2114 | 2114 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2570 | 2570 |
| 2571 default: | 2571 default: |
| 2572 NOTREACHED(); | 2572 NOTREACHED(); |
| 2573 } | 2573 } |
| 2574 } | 2574 } |
| 2575 | 2575 |
| 2576 void TabContents::set_encoding(const std::string& encoding) { | 2576 void TabContents::set_encoding(const std::string& encoding) { |
| 2577 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2577 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2578 } | 2578 } |
| 2579 | 2579 |
| OLD | NEW |