Skip to content

Commit

Permalink
refactor: move AtomNavigationThrottle out of net folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Aug 3, 2018
1 parent 1b327cd commit bf82da6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion atom/browser/api/atom_api_web_contents.cc
Expand Up @@ -24,10 +24,10 @@
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_javascript_dialog_manager.h"
#include "atom/browser/atom_navigation_throttle.h"
#include "atom/browser/child_web_contents_tracker.h"
#include "atom/browser/lib/bluetooth_chooser.h"
#include "atom/browser/native_window.h"
#include "atom/browser/net/atom_navigation_throttle.h"
#include "atom/browser/net/atom_network_delegate.h"
#if defined(ENABLE_OSR)
#include "atom/browser/osr/osr_output_device.h"
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/atom_browser_client.cc
Expand Up @@ -13,13 +13,13 @@
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_navigation_throttle.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/child_web_contents_tracker.h"
#include "atom/browser/login_handler.h"
#include "atom/browser/native_window.h"
#include "atom/browser/net/atom_navigation_throttle.h"
#include "atom/browser/session_preferences.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_contents_preferences.h"
Expand Down
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#include "atom/browser/net/atom_navigation_throttle.h"
#include "atom/browser/atom_navigation_throttle.h"

#include "atom/browser/api/atom_api_web_contents.h"
#include "content/public/browser/navigation_handle.h"
Expand All @@ -19,13 +19,17 @@ content::NavigationThrottle::ThrottleCheckResult
AtomNavigationThrottle::WillRedirectRequest() {
auto* handle = navigation_handle();
auto* contents = handle->GetWebContents();
if (!contents)
if (!contents) {
DCHECK(false); // This should be unreachable
return PROCEED;
}

auto api_contents =
atom::api::WebContents::CreateFrom(v8::Isolate::GetCurrent(), contents);
if (api_contents.IsEmpty())
if (api_contents.IsEmpty()) {
DCHECK(false); // This should be unreachable
return PROCEED;
}

if (api_contents->EmitNavigationEvent("will-redirect", handle)) {
return CANCEL;
Expand Down
Expand Up @@ -7,8 +7,6 @@

#include "content/public/browser/navigation_throttle.h"

class URLPattern;

namespace atom {

class AtomNavigationThrottle : public content::NavigationThrottle {
Expand All @@ -18,7 +16,7 @@ class AtomNavigationThrottle : public content::NavigationThrottle {

AtomNavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;

const char* GetNameForLogging() { return "AtomNavigationThrottle"; }
const char* GetNameForLogging() override { return "AtomNavigationThrottle"; }

private:
DISALLOW_COPY_AND_ASSIGN(AtomNavigationThrottle);
Expand Down
4 changes: 2 additions & 2 deletions filenames.gypi
Expand Up @@ -213,6 +213,8 @@
'atom/browser/atom_browser_main_parts_posix.cc',
'atom/browser/atom_javascript_dialog_manager.cc',
'atom/browser/atom_javascript_dialog_manager.h',
'atom/browser/atom_navigation_throttle.h',
'atom/browser/atom_navigation_throttle.cc',
'atom/browser/atom_permission_manager.cc',
'atom/browser/atom_permission_manager.h',
'atom/browser/atom_quota_permission_context.cc',
Expand Down Expand Up @@ -282,8 +284,6 @@
'atom/browser/net/asar/url_request_asar_job.h',
'atom/browser/net/atom_cert_verifier.cc',
'atom/browser/net/atom_cert_verifier.h',
'atom/browser/net/atom_navigation_throttle.h',
'atom/browser/net/atom_navigation_throttle.cc',
'atom/browser/net/atom_network_delegate.cc',
'atom/browser/net/atom_network_delegate.h',
'atom/browser/net/atom_url_request.cc',
Expand Down

0 comments on commit bf82da6

Please sign in to comment.