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

Side by Side Diff: chrome/browser/first_run.cc

Issue 173020: Make Mac first run store sentinel in Profile directory. (Closed)
Patch Set: spelling Created 11 years, 4 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 #include "chrome/browser/first_run.h" 5 #include "chrome/browser/first_run.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 // TODO(port): move more code in back from the first_run_win.cc module. 9 // TODO(port): move more code in back from the first_run_win.cc module.
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return false; 50 return false;
51 #endif 51 #endif
52 52
53 first_run_sentinel = first_run_sentinel.AppendASCII(kSentinelFile); 53 first_run_sentinel = first_run_sentinel.AppendASCII(kSentinelFile);
54 *path = first_run_sentinel; 54 *path = first_run_sentinel;
55 return true; 55 return true;
56 } 56 }
57 57
58 } // namespace 58 } // namespace
59 59
60 // TODO(port): Mac should share this code.
61 #if !defined(OS_MACOSX)
62 bool FirstRun::IsChromeFirstRun() { 60 bool FirstRun::IsChromeFirstRun() {
63 // A troolean, 0 means not yet set, 1 means set to true, 2 set to false. 61 // A troolean, 0 means not yet set, 1 means set to true, 2 set to false.
Mark Mentovai 2009/08/18 21:51:48 Ought to be an enum.
64 static int first_run = 0; 62 static int first_run = 0;
65 if (first_run != 0) 63 if (first_run != 0)
66 return first_run == 1; 64 return first_run == 1;
67 65
68 FilePath first_run_sentinel; 66 FilePath first_run_sentinel;
69 if (!GetFirstRunSentinelFilePath(&first_run_sentinel) || 67 if (!GetFirstRunSentinelFilePath(&first_run_sentinel) ||
70 file_util::PathExists(first_run_sentinel)) { 68 file_util::PathExists(first_run_sentinel)) {
71 first_run = 2; 69 first_run = 2;
72 return false; 70 return false;
73 } 71 }
74 first_run = 1; 72 first_run = 1;
75 return true; 73 return true;
76 } 74 }
77 #endif
78 75
79 bool FirstRun::RemoveSentinel() { 76 bool FirstRun::RemoveSentinel() {
80 FilePath first_run_sentinel; 77 FilePath first_run_sentinel;
81 if (!GetFirstRunSentinelFilePath(&first_run_sentinel)) 78 if (!GetFirstRunSentinelFilePath(&first_run_sentinel))
82 return false; 79 return false;
83 return file_util::Delete(first_run_sentinel, false); 80 return file_util::Delete(first_run_sentinel, false);
84 } 81 }
85 82
86 bool FirstRun::CreateSentinel() { 83 bool FirstRun::CreateSentinel() {
87 FilePath first_run_sentinel; 84 FilePath first_run_sentinel;
(...skipping 17 matching lines...) Expand all
105 PrefService* local_state = g_browser_process->local_state(); 102 PrefService* local_state = g_browser_process->local_state();
106 if (!local_state) 103 if (!local_state)
107 return false; 104 return false;
108 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { 105 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) {
109 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); 106 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false);
110 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); 107 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true);
111 } 108 }
112 return true; 109 return true;
113 } 110 }
114 111
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698