File: browser_command.mojom

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (65 lines) | stat: -rw-r--r-- 2,393 bytes parent folder | download | duplicates (7)
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
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module browser_command.mojom;

// The set of browser commands sent by the NTP promos or the What's New
// chrome.com content, and understood by the browser. They may trigger actions
// in the browser such as navigating to a chrome:// URL or initiating a helpful
// flow. The implementer of the CommandHandler interface chooses which commands
// to handle and which ones to ignore depending on the platform or the
// milestone. Note that the implementations of these commands must be
// side-effect-free.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// LINT.IfChange(Command)
enum Command {
  kUnknownCommand = 0,
  kOpenSafetyCheck = 1,
  kOpenSafeBrowsingEnhancedProtectionSettings = 2,
  kOpenFeedbackForm = 3,
  kOpenPrivacyGuide = 4,
  kStartTabGroupTutorial = 5,
  kOpenPasswordManager = 6,
  kNoOpCommand = 7,
  kOpenPerformanceSettings = 8,
  kOpenNTPAndStartCustomizeChromeTutorial = 9,
  kStartPasswordManagerTutorial = 10,
  kStartSavedTabGroupTutorial = 11,
  kOpenAISettings = 12,
  kOpenSafetyCheckFromWhatsNew = 13,
  kOpenPaymentsSettings = 14,
  // kOpenHistorySearchSettings = 15 - deprecated
  kOpenGlic = 16,
  kOpenGlicSettings = 17,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/new_tab_page/enums.xml:PromoBrowserCommandEnum)

// Click information needed to determine user's desired window disposition using
// ui::DispositionFromClick().
struct ClickInfo {
  bool middle_button;
  bool alt_key;
  bool ctrl_key;
  bool meta_key;
  bool shift_key;
};

// Implemented by the New Tab Page and What's New WebUIs that provide
// CommandHandlers to handle requests for browser commands from JS.
interface CommandHandlerFactory {
  // Called when first initialized.
  CreateBrowserCommandHandler(pending_receiver<CommandHandler> handler);
};

// Browser-side handler for requests from JS.
interface CommandHandler {
  // Returns the given command ID can be executed.
  CanExecuteCommand(Command command_id) => (bool can_execute);

  // Executes the command with the given ID and click information. Returns
  // whether or not the command was executed.
  ExecuteCommand(Command command_id, ClickInfo click_info)
      => (bool command_executed);
};