File: browser_navigator_params.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (106 lines) | stat: -rw-r--r-- 3,985 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/browser_navigator_params.h"

#include <utility>

#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/browser.h"
#endif

using content::GlobalRequestID;
using content::NavigationController;
using content::WebContents;

#if BUILDFLAG(IS_ANDROID)
NavigateParams::NavigateParams(std::unique_ptr<WebContents> contents_to_insert)
    : contents_to_insert(std::move(contents_to_insert)) {}
#else
NavigateParams::NavigateParams(Browser* a_browser,
                               const GURL& a_url,
                               ui::PageTransition a_transition)
    : url(a_url), transition(a_transition), browser(a_browser) {}

NavigateParams::NavigateParams(Browser* a_browser,
                               std::unique_ptr<WebContents> contents_to_insert)
    : contents_to_insert(std::move(contents_to_insert)), browser(a_browser) {}
#endif  // BUILDFLAG(IS_ANDROID)

NavigateParams::NavigateParams(Profile* a_profile,
                               const GURL& a_url,
                               ui::PageTransition a_transition)
    : url(a_url),
      disposition(WindowOpenDisposition::NEW_FOREGROUND_TAB),
      transition(a_transition),
      window_action(SHOW_WINDOW),
      initiating_profile(a_profile) {}

NavigateParams::NavigateParams(NavigateParams&&) = default;

NavigateParams::~NavigateParams() = default;

void NavigateParams::FillNavigateParamsFromOpenURLParams(
    const content::OpenURLParams& params) {
#if DCHECK_IS_ON()
  DCHECK(params.Valid());
#endif

  this->initiator_frame_token = params.initiator_frame_token;
  this->initiator_process_id = params.initiator_process_id;
  this->initiator_origin = params.initiator_origin;
  this->referrer = params.referrer;
  this->reload_type = params.reload_type;
  this->source_site_instance = params.source_site_instance;
  if (params.source_site_instance) {
    this->initiating_profile =
        static_cast<Profile*>(params.source_site_instance->GetBrowserContext());
  }
  this->source_contents = content::WebContents::FromRenderFrameHost(
      content::RenderFrameHost::FromID(params.source_render_process_id,
                                       params.source_render_frame_id));
  this->frame_tree_node_id = params.frame_tree_node_id;
  this->redirect_chain = params.redirect_chain;
  this->extra_headers = params.extra_headers;
  this->disposition = params.disposition;
  this->trusted_source = false;
  this->is_renderer_initiated = params.is_renderer_initiated;
  this->should_replace_current_entry = params.should_replace_current_entry;
  this->post_data = params.post_data;
  this->started_from_context_menu = params.started_from_context_menu;
  this->is_service_worker_open_window = params.is_service_worker_open_window;
  this->user_gesture = params.user_gesture;
  this->blob_url_loader_factory = params.blob_url_loader_factory;
  this->href_translate = params.href_translate;
  this->impression = params.impression;

  // Implementation notes:
  //   The following NavigateParams don't have an equivalent in OpenURLParams:
  //     browser
  //     contents_to_insert
  //     opened_by_another_window
  //     extension_app_id
  //     frame_name
  //     group
  //     input_start
  //     navigated_or_inserted_contents
  //     opener
  //     path_behavior
  //     switch_to_singleton_tab
  //     tabstrip_add_types
  //     tabstrip_index
  //     was_activated
  //     window_action
  //     window_bounds
  //
  //   The following OpenURLParams don't have an equivalent in NavigateParams:
  //     triggering_event_info
}