Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4005)

Unified Diff: chrome/browser/encoding_menu_controller_delegate.cc

Issue 7647: Character encoding override (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_commands.cc ('k') | chrome/browser/render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/encoding_menu_controller_delegate.cc
===================================================================
--- chrome/browser/encoding_menu_controller_delegate.cc (revision 3674)
+++ chrome/browser/encoding_menu_controller_delegate.cc (working copy)
@@ -9,7 +9,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/tab_contents.h"
+#include "chrome/browser/web_contents.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -29,9 +29,11 @@
TabContents* current_tab = browser_->GetSelectedTabContents();
if (!current_tab)
return false;
- std::wstring encoding_name = current_tab->encoding();
- if (encoding_name.empty())
- encoding_name = profile->GetPrefs()->GetString(prefs::kDefaultCharset);
+ std::wstring encoding;
+ if (current_tab->AsWebContents())
+ encoding = current_tab->AsWebContents()->encoding();
+ if (encoding.empty())
+ encoding = profile->GetPrefs()->GetString(prefs::kDefaultCharset);
switch (id) {
case IDC_ENCODING_AUTO_DETECT:
return profile->GetPrefs()->GetBoolean(
@@ -73,7 +75,7 @@
case IDC_ENCODING_ISO88598:
case IDC_ENCODING_WINDOWS1255:
case IDC_ENCODING_WINDOWS1258:
- return (!encoding_name.empty() && encoding_name ==
+ return (!encoding.empty() && encoding ==
CharacterEncoding::GetCanonicalEncodingNameByCommandId(id));
default:
return false;
« no previous file with comments | « chrome/browser/browser_commands.cc ('k') | chrome/browser/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698