Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: chrome/tools/build/linux/chrome-wrapper

Issue 155100: Add default browser checking and setting on Linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/temp_scaffolding_stubs.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/sh
2
3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Running Chromium via this script makes it possible to set Chromium as the
8 # default browser directly out of a compile, without needing to package it.
9
10 DESKTOP="chromium-browser"
11 TITLE="Chromium"
12
13 # Check to see if there is a desktop file of the given name
14 exists_desktop_file() {
15 # Build a search list from $XDG_DATA_HOME and $XDG_DATA_DIRS, the latter
16 # of which can itself be a colon-separated list of directories to search.
17 search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/sha re:/usr/share}"
18 IFS=:
19 for dir in $search; do
20 unset IFS
21 [ "$dir" -a -d "$dir/applications" ] || continue
22 [ -r "$dir/applications/$DESKTOP.desktop" ] && return
23 done
24 # Didn't find it in the search path
25 return 1
26 }
27
28 # Generate a desktop file that will run this script
29 generate_desktop_file() {
30 apps="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
31 cat > "$apps/$DESKTOP.desktop" << EOF
32 [Desktop Entry]
33 Version=1.0
34 Encoding=UTF-8
35 Name=$TITLE
36 Exec=$CHROME_WRAPPER %U
37 Terminal=false
38 Icon=$HERE/product_logo_48.png
39 Type=Application
40 Categories=Application;Network;WebBrowser;
41 MimeType=text/html;text/xml;application/xhtml_xml;
42 EOF
43 }
44
45 # Let the wrapped binary know that it has been run through the wrapper
46 export CHROME_WRAPPER="`readlink -f "$0"`"
47
48 HERE="`dirname "$CHROME_WRAPPER"`"
49
50 case ":$PATH:" in
51 *:$HERE:*)
52 # $PATH already contains $HERE
53 ;;
54 *)
55 # Append $HERE to $PATH
56 export PATH="$PATH:$HERE"
57 ;;
58 esac
59
60 exists_desktop_file || generate_desktop_file
61
62 exec "$HERE/chrome" "$@"
OLDNEW
« no previous file with comments | « chrome/common/temp_scaffolding_stubs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698