Skip to content

Commit f829f2e

Browse files
committed
Merge pull request electron#1002 from atom/chrome40
Upgrade to Chrome 40
2 parents de151ce + 0087f8d commit f829f2e

File tree

72 files changed

+494
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+494
-365
lines changed

atom/app/atom_content_client.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class AtomContentClient : public brightray::ContentClient {
1919

2020
protected:
2121
// content::ContentClient:
22-
virtual std::string GetProduct() const OVERRIDE;
23-
virtual void AddAdditionalSchemes(
22+
std::string GetProduct() const override;
23+
void AddAdditionalSchemes(
2424
std::vector<std::string>* standard_schemes,
25-
std::vector<std::string>* savable_schemes) OVERRIDE;
25+
std::vector<std::string>* savable_schemes) override;
2626

2727
private:
2828
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);

atom/app/atom_main.cc

+50-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
#include <fcntl.h>
1414

1515
#include <windows.h>
16+
#include <shellscalingapi.h>
17+
#include <tchar.h>
1618
#include <shellapi.h>
1719

1820
#include "atom/app/atom_main_delegate.h"
1921
#include "atom/common/crash_reporter/win/crash_service_main.h"
2022
#include "base/environment.h"
23+
#include "base/win/windows_version.h"
2124
#include "content/public/app/startup_helper_win.h"
2225
#include "sandbox/win/src/sandbox_types.h"
2326
#include "ui/gfx/win/dpi.h"
@@ -37,6 +40,48 @@ int Start(int argc, char *argv[]);
3740

3841
#if defined(OS_WIN)
3942

43+
namespace {
44+
45+
// Win8.1 supports monitor-specific DPI scaling.
46+
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
47+
typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
48+
SetProcessDpiAwarenessPtr set_process_dpi_awareness_func =
49+
reinterpret_cast<SetProcessDpiAwarenessPtr>(
50+
GetProcAddress(GetModuleHandleA("user32.dll"),
51+
"SetProcessDpiAwarenessInternal"));
52+
if (set_process_dpi_awareness_func) {
53+
HRESULT hr = set_process_dpi_awareness_func(value);
54+
if (SUCCEEDED(hr)) {
55+
VLOG(1) << "SetProcessDpiAwareness succeeded.";
56+
return true;
57+
} else if (hr == E_ACCESSDENIED) {
58+
LOG(ERROR) << "Access denied error from SetProcessDpiAwareness. "
59+
"Function called twice, or manifest was used.";
60+
}
61+
}
62+
return false;
63+
}
64+
65+
// This function works for Windows Vista through Win8. Win8.1 must use
66+
// SetProcessDpiAwareness[Wrapper].
67+
BOOL SetProcessDPIAwareWrapper() {
68+
typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID);
69+
SetProcessDPIAwarePtr set_process_dpi_aware_func =
70+
reinterpret_cast<SetProcessDPIAwarePtr>(
71+
GetProcAddress(GetModuleHandleA("user32.dll"),
72+
"SetProcessDPIAware"));
73+
return set_process_dpi_aware_func &&
74+
set_process_dpi_aware_func();
75+
}
76+
77+
void EnableHighDPISupport() {
78+
if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
79+
SetProcessDPIAwareWrapper();
80+
}
81+
}
82+
83+
} // namespace
84+
4085
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
4186
int argc = 0;
4287
wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
@@ -103,8 +148,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
103148
content::InitializeSandboxInfo(&sandbox_info);
104149
atom::AtomMainDelegate delegate;
105150

106-
// Now chrome relies on a regkey to enable high dpi support.
107-
gfx::EnableHighDPISupport();
151+
// We don't want to set DPI awareness on pre-Win7 because we don't support
152+
// DirectWrite there. GDI fonts are kerned very badly, so better to leave
153+
// DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite().
154+
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
155+
EnableHighDPISupport();
108156

109157
content::ContentMainParams params(&delegate);
110158
params.instance = instance;

atom/browser/api/atom_api_auto_updater.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ class AutoUpdater : public mate::EventEmitter,
2626
virtual ~AutoUpdater();
2727

2828
// AutoUpdaterDelegate implementations.
29-
virtual void OnError(const std::string& error) OVERRIDE;
30-
virtual void OnCheckingForUpdate() OVERRIDE;
31-
virtual void OnUpdateAvailable() OVERRIDE;
32-
virtual void OnUpdateNotAvailable() OVERRIDE;
33-
virtual void OnUpdateDownloaded(
29+
void OnError(const std::string& error) override;
30+
void OnCheckingForUpdate() override;
31+
void OnUpdateAvailable() override;
32+
void OnUpdateNotAvailable() override;
33+
void OnUpdateDownloaded(
3434
const std::string& release_notes,
3535
const std::string& release_name,
3636
const base::Time& release_date,
3737
const std::string& update_url,
38-
const base::Closure& quit_and_install) OVERRIDE;
38+
const base::Closure& quit_and_install) override;
3939

4040
// mate::Wrappable implementations:
41-
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
42-
v8::Isolate* isolate);
41+
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
42+
v8::Isolate* isolate) override;
4343

4444
private:
4545
void QuitAndInstall();

atom/browser/api/atom_api_global_shortcut.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
2828
virtual ~GlobalShortcut();
2929

3030
// mate::Wrappable implementations:
31-
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
32-
v8::Isolate* isolate) OVERRIDE;
31+
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
32+
v8::Isolate* isolate) override;
3333

3434
private:
3535
typedef std::map<ui::Accelerator, base::Closure> AcceleratorCallbackMap;
@@ -41,7 +41,7 @@ class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
4141
void UnregisterAll();
4242

4343
// GlobalShortcutListener::Observer implementation.
44-
virtual void OnKeyPressed(const ui::Accelerator& accelerator) OVERRIDE;
44+
void OnKeyPressed(const ui::Accelerator& accelerator) override;
4545

4646
AcceleratorCallbackMap accelerator_callback_map_;
4747

atom/browser/api/atom_api_menu_mac.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class MenuMac : public Menu {
1919
protected:
2020
MenuMac();
2121

22-
virtual void Popup(Window* window) OVERRIDE;
23-
virtual void PopupAt(Window* window, int x, int y) OVERRIDE;
22+
void Popup(Window* window) override;
23+
void PopupAt(Window* window, int x, int y) override;
2424

2525
base::scoped_nsobject<AtomMenuController> menu_controller_;
2626

atom/browser/api/atom_api_menu_views.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class MenuViews : public Menu {
1717
MenuViews();
1818

1919
protected:
20-
virtual void Popup(Window* window) OVERRIDE;
21-
virtual void PopupAt(Window* window, int x, int y) OVERRIDE;
20+
void Popup(Window* window) override;
21+
void PopupAt(Window* window, int x, int y) override;
2222

2323
private:
2424
void PopupAtPoint(Window* window, const gfx::Point& point);

atom/browser/api/atom_api_power_monitor.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class PowerMonitor : public mate::EventEmitter,
2424
virtual ~PowerMonitor();
2525

2626
// base::PowerObserver implementations:
27-
virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE;
28-
virtual void OnSuspend() OVERRIDE;
29-
virtual void OnResume() OVERRIDE;
27+
void OnPowerStateChange(bool on_battery_power) override;
28+
void OnSuspend() override;
29+
void OnResume() override;
3030

3131
private:
3232
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);

atom/browser/api/atom_api_protocol.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CustomProtocolRequestJob : public AdapterRequestJob {
5353
}
5454

5555
// AdapterRequestJob:
56-
virtual void GetJobTypeInUI() OVERRIDE {
56+
void GetJobTypeInUI() override {
5757
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
5858

5959
v8::Isolate* isolate = v8::Isolate::GetCurrent();
@@ -128,9 +128,9 @@ class CustomProtocolHandler : public ProtocolHandler {
128128
: registry_(registry), protocol_handler_(protocol_handler) {
129129
}
130130

131-
virtual net::URLRequestJob* MaybeCreateJob(
131+
net::URLRequestJob* MaybeCreateJob(
132132
net::URLRequest* request,
133-
net::NetworkDelegate* network_delegate) const OVERRIDE {
133+
net::NetworkDelegate* network_delegate) const override {
134134
return new CustomProtocolRequestJob(registry_, protocol_handler_.get(),
135135
request, network_delegate);
136136
}

atom/browser/api/atom_api_web_contents.cc

+16-8
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,14 @@ void WebContents::RenderViewReady() {
247247
// WebContents::GetRenderWidgetHostView will return the RWHV of an
248248
// interstitial page if one is showing at this time. We only want opacity
249249
// to apply to web pages.
250-
web_contents()->GetRenderViewHost()->GetView()->
251-
SetBackgroundOpaque(guest_opaque_);
252-
253-
content::RenderViewHost* rvh = web_contents()->GetRenderViewHost();
254-
if (auto_size_enabled_) {
255-
rvh->EnableAutoResize(min_auto_size_, max_auto_size_);
250+
if (guest_opaque_) {
251+
web_contents()
252+
->GetRenderViewHost()
253+
->GetView()
254+
->SetBackgroundColorToDefault();
256255
} else {
257-
rvh->DisableAutoResize(element_size_);
256+
web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
257+
SK_ColorTRANSPARENT);
258258
}
259259
}
260260

@@ -498,7 +498,15 @@ void WebContents::SetAllowTransparency(bool allow) {
498498
if (!web_contents()->GetRenderViewHost()->GetView())
499499
return;
500500

501-
web_contents()->GetRenderViewHost()->GetView()->SetBackgroundOpaque(!allow);
501+
if (guest_opaque_) {
502+
web_contents()
503+
->GetRenderViewHost()
504+
->GetView()
505+
->SetBackgroundColorToDefault();
506+
} else {
507+
web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
508+
SK_ColorTRANSPARENT);
509+
}
502510
}
503511

504512
mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(

atom/browser/api/event.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class Event : public Wrappable,
3434
virtual ~Event();
3535

3636
// Wrappable implementations:
37-
virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate);
37+
ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) override;
3838

3939
// content::WebContentsObserver implementations:
40-
virtual void WebContentsDestroyed() OVERRIDE;
40+
void WebContentsDestroyed() override;
4141

4242
private:
4343
// Replyer for the synchronous messages.

atom/browser/atom_access_token_store.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class AtomAccessTokenStore : public content::AccessTokenStore {
1717
virtual ~AtomAccessTokenStore();
1818

1919
// content::AccessTokenStore:
20-
virtual void LoadAccessTokens(
21-
const LoadAccessTokensCallbackType& callback) OVERRIDE;
22-
virtual void SaveAccessToken(const GURL& server_url,
23-
const base::string16& access_token) OVERRIDE;
20+
void LoadAccessTokens(
21+
const LoadAccessTokensCallbackType& callback) override;
22+
void SaveAccessToken(const GURL& server_url,
23+
const base::string16& access_token) override;
2424

2525
private:
2626
DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore);

atom/browser/atom_browser_context.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
6868
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
6969

7070
// Set up interceptors in the reverse order.
71-
scoped_ptr<net::URLRequestJobFactory> top_job_factory =
72-
job_factory.PassAs<net::URLRequestJobFactory>();
71+
scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass();
7372
content::URLRequestInterceptorScopedVector::reverse_iterator it;
7473
for (it = interceptors->rbegin(); it != interceptors->rend(); ++it)
7574
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(

atom/browser/atom_browser_main_parts.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
2727

2828
protected:
2929
// Implementations of brightray::BrowserMainParts.
30-
virtual brightray::BrowserContext* CreateBrowserContext() OVERRIDE;
30+
brightray::BrowserContext* CreateBrowserContext() override;
3131

3232
// Implementations of content::BrowserMainParts.
33-
virtual void PostEarlyInitialization() OVERRIDE;
34-
virtual void PreMainMessageLoopRun() OVERRIDE;
33+
void PostEarlyInitialization() override;
34+
void PreMainMessageLoopRun() override;
3535
#if defined(OS_MACOSX)
36-
virtual void PreMainMessageLoopStart() OVERRIDE;
37-
virtual void PostDestroyThreads() OVERRIDE;
36+
void PreMainMessageLoopStart() override;
37+
void PostDestroyThreads() override;
3838
#endif
3939

4040
private:

atom/browser/atom_javascript_dialog_manager.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,23 @@ namespace atom {
1414
class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
1515
public:
1616
// content::JavaScriptDialogManager implementations.
17-
virtual void RunJavaScriptDialog(
17+
void RunJavaScriptDialog(
1818
content::WebContents* web_contents,
1919
const GURL& origin_url,
2020
const std::string& accept_lang,
2121
content::JavaScriptMessageType javascript_message_type,
2222
const base::string16& message_text,
2323
const base::string16& default_prompt_text,
2424
const DialogClosedCallback& callback,
25-
bool* did_suppress_message) OVERRIDE;
26-
virtual void RunBeforeUnloadDialog(
25+
bool* did_suppress_message) override;
26+
void RunBeforeUnloadDialog(
2727
content::WebContents* web_contents,
2828
const base::string16& message_text,
2929
bool is_reload,
30-
const DialogClosedCallback& callback) OVERRIDE;
31-
virtual void CancelActiveAndPendingDialogs(
32-
content::WebContents* web_contents) OVERRIDE {}
33-
virtual void WebContentsDestroyed(
34-
content::WebContents* web_contents) OVERRIDE {}
30+
const DialogClosedCallback& callback) override;
31+
void CancelActiveAndPendingDialogs(
32+
content::WebContents* web_contents) override {}
33+
void WebContentsDestroyed(content::WebContents* web_contents) override {}
3534
};
3635

3736
} // namespace atom

atom/browser/native_window.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "atom/common/native_mate_converters/file_path_converter.h"
2222
#include "atom/common/options_switches.h"
2323
#include "base/command_line.h"
24-
#include "base/file_util.h"
24+
#include "base/files/file_util.h"
2525
#include "base/json/json_writer.h"
2626
#include "base/prefs/pref_service.h"
2727
#include "base/message_loop/message_loop.h"
@@ -57,6 +57,10 @@
5757
#include "ui/gfx/screen.h"
5858
#include "ui/gfx/size.h"
5959

60+
#if defined(OS_WIN)
61+
#include "ui/gfx/switches.h"
62+
#endif
63+
6064
using content::NavigationEntry;
6165
using content::RenderWidgetHostView;
6266
using content::RenderWidgetHost;

atom/browser/native_window_views.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class NativeWindowClientView : public views::ClientView {
129129
}
130130
virtual ~NativeWindowClientView() {}
131131

132-
virtual bool CanClose() OVERRIDE {
132+
bool CanClose() override {
133133
static_cast<NativeWindowViews*>(contents_view())->CloseWebContents();
134134
return false;
135135
}

atom/browser/net/adapter_request_job.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ class AdapterRequestJob : public net::URLRequestJob {
2828

2929
public:
3030
// net::URLRequestJob:
31-
virtual void Start() OVERRIDE;
32-
virtual void Kill() OVERRIDE;
33-
virtual bool ReadRawData(net::IOBuffer* buf,
34-
int buf_size,
35-
int *bytes_read) OVERRIDE;
36-
virtual bool IsRedirectResponse(GURL* location,
37-
int* http_status_code) OVERRIDE;
38-
virtual net::Filter* SetupFilter() const OVERRIDE;
39-
virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
40-
virtual bool GetCharset(std::string* charset) OVERRIDE;
31+
void Start() override;
32+
void Kill() override;
33+
bool ReadRawData(net::IOBuffer* buf,
34+
int buf_size,
35+
int *bytes_read) override;
36+
bool IsRedirectResponse(GURL* location,
37+
int* http_status_code) override;
38+
net::Filter* SetupFilter() const override;
39+
bool GetMimeType(std::string* mime_type) const override;
40+
bool GetCharset(std::string* charset) override;
4141

4242
base::WeakPtr<AdapterRequestJob> GetWeakPtr();
4343

atom/browser/net/asar/asar_protocol_handler.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class AsarProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
2727
Archive* GetOrCreateAsarArchive(const base::FilePath& path) const;
2828

2929
// net::URLRequestJobFactory::ProtocolHandler:
30-
virtual net::URLRequestJob* MaybeCreateJob(
30+
net::URLRequestJob* MaybeCreateJob(
3131
net::URLRequest* request,
32-
net::NetworkDelegate* network_delegate) const OVERRIDE;
33-
virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE;
32+
net::NetworkDelegate* network_delegate) const override;
33+
bool IsSafeRedirectTarget(const GURL& location) const override;
3434

3535
private:
3636
const scoped_refptr<base::TaskRunner> file_task_runner_;

0 commit comments

Comments
 (0)