0

Fixed all overloaded virtual methods on Windows.

This fixes the 'overloaded-virtual' Clang warning on Windows (currently
disabled; will be enabled in a follow-up CL).

- PpapiThread::PreCacheFont: Renamed to PreCacheFontForFlash to avoid
  conflict with PreCacheFont method in base class ChildThreadImpl. (This
  method is only called by another method called PreCacheFontForFlash so
  the new name is appropriate.)
- PrintingContextSytemDialogWin::InitializeSettings: Renamed to
  InitializeSettingsWithRanges to avoid conflict with InitializeSettings
  in base class PrintingContextWin. (These two methods are called on
  different code paths and the former is not meant to override the
  latter, so they should have different names.)
- Removed PrintingContextWin::ShowPrintDialog. This method was totally
  unused and its name was conflicting with a method in a subclass.

BUG=505301

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

Cr-Commit-Position: refs/heads/master@{#337735}
This commit is contained in:
mgiuca
2015-07-07 19:10:21 -07:00
committed by Commit bot
parent 2452de2def
commit 8ca5918882
12 changed files with 19 additions and 54 deletions

@ -235,7 +235,7 @@ std::string PpapiThread::GetUILanguage() {
return command_line->GetSwitchValueASCII(switches::kLang);
}
void PpapiThread::PreCacheFont(const void* logfontw) {
void PpapiThread::PreCacheFontForFlash(const void* logfontw) {
#if defined(OS_WIN)
ChildThreadImpl::PreCacheFont(*static_cast<const LOGFONTW*>(logfontw));
#endif

@ -91,7 +91,7 @@ class PpapiThread : public ChildThreadImpl,
// long as the main PpapiThread outlives it.
IPC::Sender* GetBrowserSender() override;
std::string GetUILanguage() override;
void PreCacheFont(const void* logfontw) override;
void PreCacheFontForFlash(const void* logfontw) override;
void SetActiveURL(const std::string& url) override;
PP_Resource CreateBrowserFont(ppapi::proxy::Connection connection,
PP_Instance instance,

@ -112,7 +112,7 @@ std::string PpapiDispatcher::GetUILanguage() {
return std::string();
}
void PpapiDispatcher::PreCacheFont(const void* logfontw) {
void PpapiDispatcher::PreCacheFontForFlash(const void* logfontw) {
NOTIMPLEMENTED();
}

@ -68,7 +68,7 @@ class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate,
// PluginProxyDelegate implementation.
IPC::Sender* GetBrowserSender() override;
std::string GetUILanguage() override;
void PreCacheFont(const void* logfontw) override;
void PreCacheFontForFlash(const void* logfontw) override;
void SetActiveURL(const std::string& url) override;
PP_Resource CreateBrowserFont(proxy::Connection connection,
PP_Instance instance,

@ -150,7 +150,7 @@ std::string PluginGlobals::GetCmdLine() {
void PluginGlobals::PreCacheFontForFlash(const void* logfontw) {
ProxyAutoUnlock unlock;
plugin_proxy_delegate_->PreCacheFont(logfontw);
plugin_proxy_delegate_->PreCacheFontForFlash(logfontw);
}
void PluginGlobals::LogWithSource(PP_Instance instance,

@ -30,7 +30,7 @@ class PPAPI_PROXY_EXPORT PluginProxyDelegate {
// Performs Windows-specific font caching in the browser for the given
// LOGFONTW. Does nothing on non-Windows platforms.
// Note: This method must be thread-safe.
virtual void PreCacheFont(const void* logfontw) = 0;
virtual void PreCacheFontForFlash(const void* logfontw) = 0;
// Sets the active url which is reported by breakpad.
virtual void SetActiveURL(const std::string& url) = 0;

@ -287,7 +287,7 @@ std::string PluginProxyTestHarness::PluginDelegateMock::GetUILanguage() {
return std::string("en-US");
}
void PluginProxyTestHarness::PluginDelegateMock::PreCacheFont(
void PluginProxyTestHarness::PluginDelegateMock::PreCacheFontForFlash(
const void* logfontw) {
}

@ -152,7 +152,7 @@ class PluginProxyTestHarness : public ProxyTestHarnessBase {
// PluginProxyDelegate implementation.
IPC::Sender* GetBrowserSender() override;
std::string GetUILanguage() override;
void PreCacheFont(const void* logfontw) override;
void PreCacheFontForFlash(const void* logfontw) override;
void SetActiveURL(const std::string& url) override;
PP_Resource CreateBrowserFont(
Connection connection,

@ -96,7 +96,7 @@ HRESULT PrintingContextSytemDialogWin::ShowPrintDialog(PRINTDLGEX* options) {
return PrintDlgEx(options);
}
bool PrintingContextSytemDialogWin::InitializeSettings(
bool PrintingContextSytemDialogWin::InitializeSettingsWithRanges(
const DEVMODE& dev_mode,
const std::wstring& new_device_name,
const PRINTPAGERANGE* ranges,
@ -181,11 +181,9 @@ PrintingContext::Result PrintingContextSytemDialogWin::ParseDialogResultEx(
if (dialog_options.Flags & PD_SELECTION) {
print_selection_only = true;
}
success = InitializeSettings(*dev_mode,
device_name,
page_ranges,
num_page_ranges,
print_selection_only);
success =
InitializeSettingsWithRanges(*dev_mode, device_name, page_ranges,
num_page_ranges, print_selection_only);
}
if (!success && dialog_options.hDC) {
@ -247,7 +245,8 @@ PrintingContext::Result PrintingContextSytemDialogWin::ParseDialogResult(
bool success = false;
if (dev_mode && !device_name.empty()) {
set_context(dialog_options.hDC);
success = InitializeSettings(*dev_mode, device_name, NULL, 0, false);
success =
InitializeSettingsWithRanges(*dev_mode, device_name, NULL, 0, false);
}
if (!success && dialog_options.hDC) {

@ -35,11 +35,11 @@ class PRINTING_EXPORT PrintingContextSytemDialogWin
// Reads the settings from the selected device context. Updates settings_ and
// its margins.
bool InitializeSettings(const DEVMODE& dev_mode,
const std::wstring& new_device_name,
const PRINTPAGERANGE* ranges,
int number_ranges,
bool selection_only);
bool InitializeSettingsWithRanges(const DEVMODE& dev_mode,
const std::wstring& new_device_name,
const PRINTPAGERANGE* ranges,
int number_ranges,
bool selection_only);
// Parses the result of a PRINTDLGEX result.
Result ParseDialogResultEx(const PRINTDLGEX& dialog_options);

@ -370,33 +370,4 @@ HWND PrintingContextWin::GetRootWindow(gfx::NativeView view) {
return window;
}
scoped_ptr<DEVMODE, base::FreeDeleter> PrintingContextWin::ShowPrintDialog(
HANDLE printer,
gfx::NativeView parent_view,
DEVMODE* dev_mode) {
// Note that this cannot use ui::BaseShellDialog as the print dialog is
// system modal: opening it from a background thread can cause Windows to
// get the wrong Z-order which will make the print dialog appear behind the
// browser frame (but still being modal) so neither the browser frame nor
// the print dialog will get any input. See http://crbug.com/342697
// http://crbug.com/180997 for details.
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
bool canceled = false;
scoped_ptr<DEVMODE, base::FreeDeleter> result =
PromptDevMode(printer,
settings_.device_name(),
dev_mode,
GetRootWindow(parent_view),
&canceled);
if (canceled) {
result.reset();
abort_printing_ = true;
}
return result.Pass();
}
} // namespace printing

@ -53,11 +53,6 @@ class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
void set_context(HDC context) { context_ = context; }
private:
virtual scoped_ptr<DEVMODE, base::FreeDeleter> ShowPrintDialog(
HANDLE printer,
gfx::NativeView parent_view,
DEVMODE* dev_mode);
// Used in response to the user canceling the printing.
static BOOL CALLBACK AbortProc(HDC hdc, int nCode);