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
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187

content / common / renderer.mojom [blame]

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module content.mojom;

import "content/common/agent_scheduling_group.mojom";
import "content/common/native_types.mojom";
import "ipc/ipc.mojom";
import "mojo/public/mojom/base/generic_pending_receiver.mojom";
import "mojo/public/mojom/base/process_priority.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";
import "mojo/public/mojom/base/time.mojom";
import "services/network/public/mojom/network_types.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
import "third_party/blink/public/mojom/origin_trials/origin_trials_settings.mojom";
import "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom";

struct UpdateScrollbarThemeParams {
  // TODO(avi): Update these to optional values when optional numeric types are
  // allowed. (https://crbug.com/657632)
  bool has_initial_button_delay;
  float initial_button_delay;
  bool has_autoscroll_button_delay;
  float autoscroll_button_delay;

  bool jump_on_track_click;
  ScrollerStyle preferred_scroller_style;
  bool redraw;

  bool scroll_view_rubber_banding;
};

struct UpdateSystemColorInfoParams {
  // Accent color used by the system. Currently only set on ChromeOS.
  uint32? accent_color;
};

// The visibility state for the renderer process, indicating whether or not any
// of the frames associated with the renderer process are visible.
enum RenderProcessVisibleState {
  kVisible,
  kHidden,
};

// The primordial Channel-associated interface implemented by a render process.
// This should be used for implementing browser-to-renderer control messages
// which need to retain FIFO with respect to legacy IPC messages.
interface Renderer {
  // Tells the renderer to create a new AgentSchedulingGroup, and initialize its
  // legacy IPC Channel using the pipe provided by `bootstrap`. The channel will
  // later be used to bind the mojom::AgentSchedulingGroup receiver, that
  // listens to messages sent by the host.
  // This will create an "independent" agent scheduling group that is not
  // associated with the process-wide or other groups' IPC channels, meaning
  // there is no guaranteed ordering between them.
  CreateAgentSchedulingGroup(
    pending_receiver<IPC.mojom.ChannelBootstrap> bootstrap);

  // Tells the renderer to create a new AgentSchedulingGroup, that will
  // listen to messages sent by the host via the pending
  // |agent_scheduling_group|.
  // This will create an agent scheduling group that is associated with the
  // process-wide IPC channel, preserving message ordering across different
  // agent scheduling groups.
  CreateAssociatedAgentSchedulingGroup(
    pending_associated_receiver<AgentSchedulingGroup> agent_scheduling_group);

  // Transfers the ReadOnlySharedMemoryRegions which are used to communicate
  // state values between the browser and the renderer. If any region handle is
  // invalid, the renderer will use default state instead of reading from that
  // memory region.
  //
  // `last_foreground_time_region` contains a `std::atomic<base::TimeTicks>`
  // representing the time at which this renderer was last upgraded to run at
  // foreground priority or a null TimeTicks if it's currently running at
  // best-effort priority.
  //
  // `performance_scenario_region` contains a list of `std::atomic` enums
  // representing scenarios local to the renderer that it should use when
  // making performance decisions.
  //
  // `global_performance_scenario_region` contains a list of `std::atomic`
  // enums representing global scenarios that  the renderer should use when
  // making performance decisions.
  TransferSharedMemoryRegions(
      mojo_base.mojom.ReadOnlySharedMemoryRegion? last_foreground_time_region,
      mojo_base.mojom.ReadOnlySharedMemoryRegion? performance_scenario_region,
      mojo_base.mojom.ReadOnlySharedMemoryRegion?
          global_performance_scenario_region);

  // Tells the renderer that the network type has changed so that
  // navigator.onLine and navigator.connection can be updated.
  OnNetworkConnectionChanged(NetworkConnectionType connection_type,
                             double max_bandwidth_mbps);

  // Tells the renderer process that the network quality estimate has changed.
  // EffectiveConnectionType is the connection type whose typical performance is
  // most similar to the measured performance of the network in use.
  // The downstream throughput is computed in kilobits per second. If an
  // estimate of the HTTP or transport RTT is unavailable, it will be set to
  // net::nqe::internal::InvalidRTT(). If the throughput estimate is
  // unavailable, it will be set to net::nqe::internal::INVALID_RTT_THROUGHPUT.
  OnNetworkQualityChanged(
      network.mojom.EffectiveConnectionType effective_connection_type,
      mojo_base.mojom.TimeDelta http_rtt,
      mojo_base.mojom.TimeDelta transport_rtt,
      double bandwidth_kbps);

  // Tells the renderer to suspend/resume the webkit timers. Only for use on
  // Android.
  SetWebKitSharedTimersSuspended(bool suspend);

  // Tells the renderer about a scrollbar appearance change. Only for use on
  // OS X.
  UpdateScrollbarTheme(UpdateScrollbarThemeParams params);

  // Notification that the OS X Aqua color preferences changed.
  OnSystemColorsChanged(int32 aqua_color_variant);

  // Tells the renderer process the new system color info.
  UpdateSystemColorInfo(UpdateSystemColorInfoParams params);

  // Tells the renderer to empty its plugin list cache, optional reloading
  // pages containing plugins.
  PurgePluginListCache(bool reload_pages);

  // Tells the renderer to purge its in-memory resource cache.
  PurgeResourceCache() => ();

  // Tells the renderer process of a change in visibility or priority state.
  SetProcessState(mojo_base.mojom.ProcessPriority process_priority,
                  RenderProcessVisibleState visible_state);

  // Tells the renderer process that it has been locked to a site (i.e., a
  // scheme plus eTLD+1, such as https://google.com), or to a more specific
  // origin.
  SetIsLockedToSite();

  // Write out the accumulated code profiling profile to the configured file.
  // The callback is invoked once the profile has been flushed to disk.
  [EnableIf=clang_profiling_inside_sandbox]
  WriteClangProfilingProfile() => ();

  // Set whether this renderer process is "cross-origin isolated". This
  // corresponds to agent cluster's "cross-origin isolated" concept.
  // TODO(yhirano): Have the spec URL.
  // This property is process global because we ensure that a renderer process
  // host only cross-origin isolated agents or only non-cross-origin isolated
  // agents, not both.
  // This is called at most once, prior to committing a navigation.
  SetIsCrossOriginIsolated(bool value);

  // Sets whether `--disable-web-security` has been set.
  //
  // This is called at most once on process startup.
  SetIsWebSecurityDisabled(bool value);

  // Set whether this renderer process is allowed to use Isolated Context APIs.
  // Similarly to the `SetIsCrossOriginIsolated()` method above, this flag is
  // process global, and called at most once, prior to committing a navigation.
  //
  // TODO(crbug.com/40180791): We need a specification for this restriction.
  SetIsIsolatedContext(bool value);

  // Initialize renderer user agent string, user agent metadata, CORS exempt
  // header list and origin trials settings on renderer startup.
  //
  // |user_agent| sets the user-agent string. This is needed because getting the
  // value in the renderer from the system leads to a wrong value due to
  // sandboxing. This must be called as early as possible, during the renderer
  // process initialization.
  //
  // |metadata| sets the user agent metadata. This will replace `SetUserAgent()`
  // if we decide to ship https://github.com/WICG/ua-client-hints.
  //
  // |cors_exempt_header_list| sets the CORS exempt header list for sanity
  // checking (e.g. DCHECKs).
  //
  // |origin_trials_settings| sets the settings used to build a
  // blink::OriginTrialPolicy for the renderer. It can be null if the embedder
  // does not support origin trials.
  InitializeRenderer(string user_agent,
                     blink.mojom.UserAgentMetadata metadata,
                     array<string> cors_exempt_header_list,
                     blink.mojom.OriginTrialsSettings? origin_trials_settings);
};