| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MAC_DOCK_H_ | 5 #ifndef CHROME_BROWSER_MAC_DOCK_H_ |
| 6 #define CHROME_BROWSER_MAC_DOCK_H_ | 6 #define CHROME_BROWSER_MAC_DOCK_H_ |
| 7 | 7 |
| 8 #if defined(__OBJC__) | 8 #if defined(__OBJC__) |
| 9 @class NSString; | 9 @class NSString; |
| 10 #else | 10 #else |
| 11 class NSString; | 11 class NSString; |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 namespace dock { | 14 namespace dock { |
| 15 | 15 |
| 16 enum AddIconStatus { |
| 17 IconAddFailure, |
| 18 IconAddSuccess, |
| 19 IconAlreadyPresent |
| 20 }; |
| 21 |
| 16 // Adds an icon to the Dock pointing to |installed_path| if one is not already | 22 // Adds an icon to the Dock pointing to |installed_path| if one is not already |
| 17 // present. |dmg_app_path| is the path to the install source. Its tile will be | 23 // present. |dmg_app_path| is the path to the install source. Its tile will be |
| 18 // removed if present. If any changes are made to the Dock's configuration, | 24 // removed if present. If any changes are made to the Dock's configuration, |
| 19 // the Dock process is restarted so that the changes become visible in the UI. | 25 // the Dock process is restarted so that the changes become visible in the UI. |
| 20 // | 26 // |
| 21 // Various heuristics are used to determine where to place the new icon | 27 // Various heuristics are used to determine where to place the new icon |
| 22 // relative to other items already present in the Dock: | 28 // relative to other items already present in the Dock: |
| 23 // - If installed_path is already in the Dock, no new tiles for this path | 29 // - If installed_path is already in the Dock, no new tiles for this path |
| 24 // will be added. | 30 // will be added. |
| 25 // - If dmg_app_path is present in the Dock, it will be removed. If | 31 // - If dmg_app_path is present in the Dock, it will be removed. If |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 // will be treated as a browser. If the user renames an application on disk, | 48 // will be treated as a browser. If the user renames an application on disk, |
| 43 // it will alter the result. Looking up the bundle ID could be slightly more | 49 // it will alter the result. Looking up the bundle ID could be slightly more |
| 44 // robust in the presence of such alterations, but it's not thought to be a | 50 // robust in the presence of such alterations, but it's not thought to be a |
| 45 // large enough problem to warrant such lookups. | 51 // large enough problem to warrant such lookups. |
| 46 // | 52 // |
| 47 // The changes made to the Dock's configuration are the minimal changes | 53 // The changes made to the Dock's configuration are the minimal changes |
| 48 // necessary to cause the desired behavior. Although it's possible to set | 54 // necessary to cause the desired behavior. Although it's possible to set |
| 49 // additional properties on the dock tile added to the Dock's plist, this | 55 // additional properties on the dock tile added to the Dock's plist, this |
| 50 // is not done. Upon relaunch, Dock.app will determine the correct values for | 56 // is not done. Upon relaunch, Dock.app will determine the correct values for |
| 51 // the properties it requires and add them to its configuration. | 57 // the properties it requires and add them to its configuration. |
| 52 void AddIcon(NSString* installed_path, NSString* dmg_app_path); | 58 AddIconStatus AddIcon(NSString* installed_path, NSString* dmg_app_path); |
| 53 | 59 |
| 54 } // namespace dock | 60 } // namespace dock |
| 55 | 61 |
| 56 #endif // CHROME_BROWSER_MAC_DOCK_H_ | 62 #endif // CHROME_BROWSER_MAC_DOCK_H_ |
| OLD | NEW |