Code cleanup
This commit is contained in:
parent
fd2bc76bc9
commit
21f7316a18
5 changed files with 38 additions and 61 deletions
|
@ -11,8 +11,8 @@
|
||||||
#include "atom/browser/atom_access_token_store.h"
|
#include "atom/browser/atom_access_token_store.h"
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
#include "atom/browser/atom_browser_resource_dispatcher_host_delegate.h"
|
|
||||||
#include "atom/browser/atom_quota_permission_context.h"
|
#include "atom/browser/atom_quota_permission_context.h"
|
||||||
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
||||||
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
// Copyright (c) 2015 GitHub, Inc.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "atom/browser/atom_browser_resource_dispatcher_host_delegate.h"
|
|
||||||
|
|
||||||
#include "atom/common/platform_util.h"
|
|
||||||
#include "content/public/browser/browser_thread.h"
|
|
||||||
#include "content/public/browser/web_contents.h"
|
|
||||||
#include "content/public/browser/render_view_host.h"
|
|
||||||
#include "net/base/escape.h"
|
|
||||||
|
|
||||||
using content::BrowserThread;
|
|
||||||
|
|
||||||
namespace atom {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
void HandleExternalProtocolInUI(const GURL& url,
|
|
||||||
int render_process_id,
|
|
||||||
int render_view_id) {
|
|
||||||
auto web_contents = content::WebContents::FromRenderViewHost(
|
|
||||||
content::RenderViewHost::FromID(render_process_id, render_view_id));
|
|
||||||
if (!web_contents)
|
|
||||||
return;
|
|
||||||
|
|
||||||
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
|
|
||||||
platform_util::OpenExternal(escaped_url);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
AtomResourceDispatcherHostDelegate::~AtomResourceDispatcherHostDelegate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
|
|
||||||
const GURL& url,
|
|
||||||
int render_process_id,
|
|
||||||
int render_view_id,
|
|
||||||
bool is_main_frame,
|
|
||||||
ui::PageTransition transition,
|
|
||||||
bool has_user_gesture) {
|
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
|
||||||
base::Bind(&HandleExternalProtocolInUI,
|
|
||||||
url,
|
|
||||||
render_process_id,
|
|
||||||
render_view_id));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace atom
|
|
32
atom/browser/atom_resource_dispatcher_host_delegate.cc
Normal file
32
atom/browser/atom_resource_dispatcher_host_delegate.cc
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
||||||
|
|
||||||
|
#include "atom/common/platform_util.h"
|
||||||
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
#include "net/base/escape.h"
|
||||||
|
#include "url/gurl.h"
|
||||||
|
|
||||||
|
using content::BrowserThread;
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
|
||||||
|
const GURL& url,
|
||||||
|
int render_process_id,
|
||||||
|
int render_view_id,
|
||||||
|
bool is_main_frame,
|
||||||
|
ui::PageTransition transition,
|
||||||
|
bool has_user_gesture) {
|
||||||
|
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
|
||||||
|
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
||||||
|
base::Bind(base::IgnoreResult(platform_util::OpenExternal), escaped_url));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
#ifndef ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
||||||
#define ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
#define ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
||||||
|
|
||||||
#include "content/public/browser/resource_dispatcher_host_delegate.h"
|
#include "content/public/browser/resource_dispatcher_host_delegate.h"
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ class AtomResourceDispatcherHostDelegate
|
||||||
: public content::ResourceDispatcherHostDelegate {
|
: public content::ResourceDispatcherHostDelegate {
|
||||||
public:
|
public:
|
||||||
AtomResourceDispatcherHostDelegate();
|
AtomResourceDispatcherHostDelegate();
|
||||||
~AtomResourceDispatcherHostDelegate();
|
|
||||||
|
|
||||||
// content::ResourceDispatcherHostDelegate:
|
// content::ResourceDispatcherHostDelegate:
|
||||||
bool HandleExternalProtocol(const GURL& url,
|
bool HandleExternalProtocol(const GURL& url,
|
||||||
|
@ -26,4 +25,4 @@ class AtomResourceDispatcherHostDelegate
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
||||||
#endif // ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
#endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
|
@ -125,12 +125,12 @@
|
||||||
'atom/browser/atom_browser_main_parts.h',
|
'atom/browser/atom_browser_main_parts.h',
|
||||||
'atom/browser/atom_browser_main_parts_linux.cc',
|
'atom/browser/atom_browser_main_parts_linux.cc',
|
||||||
'atom/browser/atom_browser_main_parts_mac.mm',
|
'atom/browser/atom_browser_main_parts_mac.mm',
|
||||||
'atom/browser/atom_browser_resource_dispatcher_host_delegate.cc',
|
|
||||||
'atom/browser/atom_browser_resource_dispatcher_host_delegate.h',
|
|
||||||
'atom/browser/atom_javascript_dialog_manager.cc',
|
'atom/browser/atom_javascript_dialog_manager.cc',
|
||||||
'atom/browser/atom_javascript_dialog_manager.h',
|
'atom/browser/atom_javascript_dialog_manager.h',
|
||||||
'atom/browser/atom_quota_permission_context.cc',
|
'atom/browser/atom_quota_permission_context.cc',
|
||||||
'atom/browser/atom_quota_permission_context.h',
|
'atom/browser/atom_quota_permission_context.h',
|
||||||
|
'atom/browser/atom_resource_dispatcher_host_delegate.cc',
|
||||||
|
'atom/browser/atom_resource_dispatcher_host_delegate.h',
|
||||||
'atom/browser/atom_speech_recognition_manager_delegate.cc',
|
'atom/browser/atom_speech_recognition_manager_delegate.cc',
|
||||||
'atom/browser/atom_speech_recognition_manager_delegate.h',
|
'atom/browser/atom_speech_recognition_manager_delegate.h',
|
||||||
'atom/browser/atom_ssl_config_service.cc',
|
'atom/browser/atom_ssl_config_service.cc',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue