blob: cb022da8fdd37000fd5f2641f3c8c79937f11693 [file] [log] [blame]
[email protected]3dd0e202011-07-18 21:45:521// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_MAC_DOCK_H_
6#define CHROME_BROWSER_MAC_DOCK_H_
[email protected]3dd0e202011-07-18 21:45:527
8#if defined(__OBJC__)
9@class NSString;
10#else
11class NSString;
12#endif
13
14namespace dock {
15
Jayson Adams742b35e2017-10-03 21:21:2616enum ChromeInDockStatus {
17 ChromeInDockFailure,
18 ChromeInDockFalse,
19 ChromeInDockTrue
20};
21
[email protected]4e0b5e022013-10-23 07:23:1522enum AddIconStatus {
23 IconAddFailure,
24 IconAddSuccess,
25 IconAlreadyPresent
26};
27
Jayson Adams742b35e2017-10-03 21:21:2628// Returns info about Chrome's presence in the Dock.
29ChromeInDockStatus ChromeIsInTheDock();
30
[email protected]3dd0e202011-07-18 21:45:5231// Adds an icon to the Dock pointing to |installed_path| if one is not already
32// present. |dmg_app_path| is the path to the install source. Its tile will be
33// removed if present. If any changes are made to the Dock's configuration,
34// the Dock process is restarted so that the changes become visible in the UI.
35//
36// Various heuristics are used to determine where to place the new icon
37// relative to other items already present in the Dock:
38// - If installed_path is already in the Dock, no new tiles for this path
39// will be added.
40// - If dmg_app_path is present in the Dock, it will be removed. If
41// installed_path is not already present, the new tile referencing
42// installed_path will be placed where the dmg_app_path tile was. This
43// keeps the tile where a user expects it if they dragged the application
44// icon from a disk image into the Dock and then clicked on the new icon
45// in the Dock.
46// - The new tile will precede any application with the same name already
47// in the Dock.
48// - In an official build, a new tile for Google Chrome will be placed
49// immediately before the first existing tile for Google Chrome Canary,
50// and a new tile for Google Chrome Canary will be placed immediately after
51// the last existing tile for Google Chrome.
52// - The new tile will be placed immediately after the last tile for another
53// browser application already in the Dock.
54// - The new tile will be placed last in the Dock.
55// For the purposes of these comparisons, applications are identified by the
56// last component in their path. For example, any application named Safari.app
57// will be treated as a browser. If the user renames an application on disk,
58// it will alter the result. Looking up the bundle ID could be slightly more
59// robust in the presence of such alterations, but it's not thought to be a
60// large enough problem to warrant such lookups.
61//
62// The changes made to the Dock's configuration are the minimal changes
63// necessary to cause the desired behavior. Although it's possible to set
64// additional properties on the dock tile added to the Dock's plist, this
65// is not done. Upon relaunch, Dock.app will determine the correct values for
66// the properties it requires and add them to its configuration.
[email protected]4e0b5e022013-10-23 07:23:1567AddIconStatus AddIcon(NSString* installed_path, NSString* dmg_app_path);
[email protected]3dd0e202011-07-18 21:45:5268
69} // namespace dock
70
71#endif // CHROME_BROWSER_MAC_DOCK_H_