| Index: chrome/browser/automation/automation_provider.cc
|
| ===================================================================
|
| --- chrome/browser/automation/automation_provider.cc (revision 31188)
|
| +++ chrome/browser/automation/automation_provider.cc (working copy)
|
| @@ -414,6 +414,8 @@
|
| SetBooleanPreference)
|
| IPC_MESSAGE_HANDLER(AutomationMsg_GetPageCurrentEncoding,
|
| GetPageCurrentEncoding)
|
| + IPC_MESSAGE_HANDLER(AutomationMsg_ToggleEncodingAutoDetect,
|
| + ToggleEncodingAutoDetect)
|
| IPC_MESSAGE_HANDLER(AutomationMsg_OverrideEncoding, OverrideEncoding)
|
| IPC_MESSAGE_HANDLER(AutomationMsg_SavePackageShouldPromptUser,
|
| SavePackageShouldPromptUser)
|
| @@ -1864,8 +1866,8 @@
|
|
|
| void AutomationProvider::GetBooleanPreference(int handle,
|
| const std::wstring& name,
|
| - bool* success,
|
| - bool* value) {
|
| + bool* value,
|
| + bool* success) {
|
| *success = false;
|
| *value = false;
|
| if (browser_tracker_->ContainsHandle(handle)) {
|
| @@ -1900,7 +1902,30 @@
|
| }
|
| }
|
|
|
| -// Gets the current used encoding name of the page in the specified tab.
|
| +// Toggles the encoding auto-detect setting.
|
| +// While the setting is global, the tab needs to be specified as it may need
|
| +// to be reloaded.
|
| +void AutomationProvider::ToggleEncodingAutoDetect(int tab_handle,
|
| + bool* success) {
|
| + *success = false;
|
| +#if defined(OS_WIN)
|
| + if (tab_tracker_->ContainsHandle(tab_handle)) {
|
| + NavigationController* nav = tab_tracker_->GetResource(tab_handle);
|
| + Browser* browser = FindAndActivateTab(nav);
|
| + DCHECK(browser);
|
| +
|
| + if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) {
|
| + browser->ToggleEncodingAutoDetect();
|
| + *success = true;
|
| + }
|
| + }
|
| +#else
|
| + // TODO(port): Enable when encoding-related parts of Browser are ported.
|
| + NOTIMPLEMENTED();
|
| +#endif
|
| +}
|
| +
|
| +// Sets the override encoding for the page in the specified tab.
|
| void AutomationProvider::OverrideEncoding(int tab_handle,
|
| const std::string& encoding_name,
|
| bool* success) {
|
|
|