OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/win/registry.h" | 11 #include "base/win/registry.h" |
12 #include "chrome/browser/background/background_mode_manager.h" | 12 #include "chrome/browser/background/background_mode_manager.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "chrome/installer/util/auto_launch_util.h" | 16 #include "chrome/installer/util/auto_launch_util.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/gfx/image/image_skia.h" | 19 #include "ui/gfx/image/image_skia.h" |
20 #include "ui/message_center/notifier_settings.h" | |
20 | 21 |
21 using content::BrowserThread; | 22 using content::BrowserThread; |
22 | 23 |
24 namespace { | |
25 | |
26 const char kAppInstalledNotifierId[] = "background-mode.app-installed"; | |
Peter Beverloo
2015/10/10 16:35:27
nit: no need for the anonymous namespace here, con
johnme
2015/10/12 14:34:09
Done.
| |
27 | |
28 } // namespace | |
29 | |
23 void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { | 30 void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { |
24 // This functionality is only defined for default profile, currently. | 31 // This functionality is only defined for default profile, currently. |
25 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserDataDir)) | 32 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserDataDir)) |
26 return; | 33 return; |
27 BrowserThread::PostTask( | 34 BrowserThread::PostTask( |
28 BrowserThread::FILE, FROM_HERE, | 35 BrowserThread::FILE, FROM_HERE, |
29 should_launch ? | 36 should_launch ? |
30 base::Bind(auto_launch_util::EnableBackgroundStartAtLogin) : | 37 base::Bind(auto_launch_util::EnableBackgroundStartAtLogin) : |
31 base::Bind(auto_launch_util::DisableBackgroundStartAtLogin)); | 38 base::Bind(auto_launch_util::DisableBackgroundStartAtLogin)); |
32 } | 39 } |
33 | 40 |
34 void BackgroundModeManager::DisplayClientInstalledNotification( | 41 void BackgroundModeManager::DisplayClientInstalledNotification( |
35 const base::string16& name) { | 42 const base::string16& name) { |
36 // Create a status tray notification balloon explaining to the user what has | 43 // Create a status tray notification balloon explaining to the user what has |
37 // been installed. | 44 // been installed. |
38 CreateStatusTrayIcon(); | 45 CreateStatusTrayIcon(); |
39 status_icon_->DisplayBalloon( | 46 status_icon_->DisplayBalloon( |
40 gfx::ImageSkia(), | 47 gfx::ImageSkia(), |
41 l10n_util::GetStringUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE), | 48 l10n_util::GetStringUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE), |
42 l10n_util::GetStringFUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY, | 49 l10n_util::GetStringFUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY, |
43 name, | 50 name, |
44 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 51 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)), |
52 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | |
53 kAppInstalledNotifierId)); | |
45 } | 54 } |
46 | 55 |
47 base::string16 BackgroundModeManager::GetPreferencesMenuLabel() { | 56 base::string16 BackgroundModeManager::GetPreferencesMenuLabel() { |
48 return l10n_util::GetStringUTF16(IDS_OPTIONS); | 57 return l10n_util::GetStringUTF16(IDS_OPTIONS); |
49 } | 58 } |
OLD | NEW |