Skip to content

Commit

Permalink
Revert r156303 as non-Aura Metro mode is gone
Browse files Browse the repository at this point in the history
We no longer need to support TSF in the browser code. Now TSF-related code
is completely consolidated into the metro_driver process and the browser
process doesn't need to know about TSF any more.

Note: TSF-related code remaining in base/win/metro.{cc, h} and
content/browser/browser_main_runner.{h, cc} will be reverted by subsequent CLs.

BUG=319122, 330735

Review URL: https://codereview.chromium.org/137493006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248475 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
yukawa@chromium.org committed Feb 3, 2014
1 parent 19b75c7 commit b4b591b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 53 deletions.
34 changes: 1 addition & 33 deletions base/win/metro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
namespace base {
namespace win {

namespace {
bool g_should_tsf_aware_required = false;
}

HMODULE GetMetroModule() {
const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1);
static HMODULE metro_module = kUninitialized;
Expand Down Expand Up @@ -73,35 +69,7 @@ bool IsProcessImmersive(HANDLE process) {
bool IsTSFAwareRequired() {
// Although this function is equal to IsMetroProcess at this moment,
// Chrome for Win7 and Vista may support TSF in the future.
return g_should_tsf_aware_required || IsMetroProcess();
}

void SetForceToUseTSF() {
g_should_tsf_aware_required = true;

// Since Windows 8 Metro mode disables CUAS (Cicero Unaware Application
// Support) via ImmDisableLegacyIME API, Chrome must be fully TSF-aware on
// Metro mode. For debugging purposes, explicitly call ImmDisableLegacyIME so
// that one can test TSF functionality even on Windows 8 desktop mode. Note
// that CUAS cannot be disabled on Windows Vista/7 where ImmDisableLegacyIME
// is not available.
typedef BOOL (* ImmDisableLegacyIMEFunc)();
HMODULE imm32 = ::GetModuleHandleA("imm32.dll");
if (imm32 == NULL)
return;

ImmDisableLegacyIMEFunc imm_disable_legacy_ime =
reinterpret_cast<ImmDisableLegacyIMEFunc>(
::GetProcAddress(imm32, "ImmDisableLegacyIME"));

if (imm_disable_legacy_ime == NULL) {
// Unsupported API, just do nothing.
return;
}

if (!imm_disable_legacy_ime()) {
DVLOG(1) << "Failed to disable legacy IME.";
}
return IsMetroProcess();
}

wchar_t* LocalAllocAndCopyString(const string16& src) {
Expand Down
7 changes: 0 additions & 7 deletions base/win/metro.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ BASE_EXPORT bool IsProcessImmersive(HANDLE process);
// and browser must be TSF-aware.
BASE_EXPORT bool IsTSFAwareRequired();

// Sets browser to use Text Services Framework (TSF) regardless of process
// status. On Windows 8, this function also disables CUAS (Cicero Unaware
// Application Support) to emulate Windows Metro mode in terms of IME
// functionality. This should be beneficial in QA process because on can test
// IME functionality in Windows 8 desktop mode.
BASE_EXPORT void SetForceToUseTSF();

// Allocates and returns the destination string via the LocalAlloc API after
// copying the src to it.
BASE_EXPORT wchar_t* LocalAllocAndCopyString(const string16& src);
Expand Down
11 changes: 3 additions & 8 deletions content/browser/browser_main_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "ui/base/ime/input_method_initializer.h"

#if defined(OS_WIN)
#include "base/win/metro.h"
#include "base/win/windows_version.h"
#include "ui/base/win/scoped_ole_initializer.h"
#endif
Expand Down Expand Up @@ -54,17 +53,13 @@ class BrowserMainRunnerImpl : public BrowserMainRunner {
#endif

#if defined(OS_WIN)
if (parameters.command_line.HasSwitch(
switches::kEnableTextServicesFramework)) {
base::win::SetForceToUseTSF();
} else if (base::win::GetVersion() < base::win::VERSION_VISTA) {
if (base::win::GetVersion() < base::win::VERSION_VISTA) {
// When "Extend support of advanced text services to all programs"
// (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on
// Windows XP and handwriting modules shipped with Office 2003 are
// installed, "penjpn.dll" and "skchui.dll" will be loaded and then
// crash
// unless a user installs Office 2003 SP3. To prevent these modules from
// being loaded, disable TSF entirely. crbug/160914.
// crash unless a user installs Office 2003 SP3. To prevent these
// modules from being loaded, disable TSF entirely. crbug.com/160914.
// TODO(yukawa): Add a high-level wrapper for this instead of calling
// Win32 API here directly.
ImmDisableTextFrameService(static_cast<DWORD>(-1));
Expand Down
4 changes: 0 additions & 4 deletions content/public/common/content_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,6 @@ const char kEnableServiceWorker[] = "enable-service-worker";
// SYN packet.
const char kEnableTcpFastOpen[] = "enable-tcp-fastopen";

// Enable Text Service Framework(TSF) for text inputting instead of IMM32. This
// flag is ignored on Metro environment.
const char kEnableTextServicesFramework[] = "enable-text-services-framework";

// Enable multithreaded GPU compositing of web content.
const char kEnableThreadedCompositing[] = "enable-threaded-compositing";

Expand Down
1 change: 0 additions & 1 deletion content/public/common/content_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ extern const char kEnableStrictSiteIsolation[];
CONTENT_EXPORT extern const char kEnableServiceWorker[];
CONTENT_EXPORT extern const char kEnableTargetedStyleRecalc[];
CONTENT_EXPORT extern const char kEnableTcpFastOpen[];
CONTENT_EXPORT extern const char kEnableTextServicesFramework[];
CONTENT_EXPORT extern const char kEnableThreadedCompositing[];
CONTENT_EXPORT extern const char kEnableUniversalAcceleratedOverflowScroll[];
CONTENT_EXPORT extern const char kEnableUserMediaScreenCapturing[];
Expand Down

0 comments on commit b4b591b

Please sign in to comment.