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 "chrome/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/environment.h" | 12 #include "base/environment.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/env_vars.h" | 22 #include "chrome/common/env_vars.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/service_process_util.h" | 24 #include "chrome/common/service_process_util.h" |
25 #include "chrome/service/cloud_print/cloud_print_proxy.h" | 25 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
26 #include "chrome/service/net/service_url_request_context.h" | 26 #include "chrome/service/net/service_url_request_context.h" |
27 #include "chrome/service/service_ipc_server.h" | 27 #include "chrome/service/service_ipc_server.h" |
28 #include "chrome/service/service_process_prefs.h" | 28 #include "chrome/service/service_process_prefs.h" |
29 #include "content/public/common/url_fetcher.h" | |
30 #include "grit/chromium_strings.h" | 29 #include "grit/chromium_strings.h" |
31 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
32 #include "net/base/network_change_notifier.h" | 31 #include "net/base/network_change_notifier.h" |
| 32 #include "net/url_request/url_fetcher.h" |
33 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
34 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/base/ui_base_switches.h" | 35 #include "ui/base/ui_base_switches.h" |
36 | 36 |
37 #if defined(TOOLKIT_GTK) | 37 #if defined(TOOLKIT_GTK) |
| 38 #include <gtk/gtk.h> |
38 #include "ui/gfx/gtk_util.h" | 39 #include "ui/gfx/gtk_util.h" |
39 #include <gtk/gtk.h> | |
40 #endif | 40 #endif |
41 | 41 |
42 ServiceProcess* g_service_process = NULL; | 42 ServiceProcess* g_service_process = NULL; |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 // Delay in seconds after the last service is disabled before we attempt | 46 // Delay in seconds after the last service is disabled before we attempt |
47 // a shutdown. | 47 // a shutdown. |
48 const int kShutdownDelaySeconds = 60; | 48 const int kShutdownDelaySeconds = 60; |
49 | 49 |
(...skipping 14 matching lines...) Expand all Loading... |
64 private: | 64 private: |
65 DISALLOW_COPY_AND_ASSIGN(ServiceIOThread); | 65 DISALLOW_COPY_AND_ASSIGN(ServiceIOThread); |
66 }; | 66 }; |
67 | 67 |
68 ServiceIOThread::ServiceIOThread(const char* name) : base::Thread(name) {} | 68 ServiceIOThread::ServiceIOThread(const char* name) : base::Thread(name) {} |
69 ServiceIOThread::~ServiceIOThread() { | 69 ServiceIOThread::~ServiceIOThread() { |
70 Stop(); | 70 Stop(); |
71 } | 71 } |
72 | 72 |
73 void ServiceIOThread::CleanUp() { | 73 void ServiceIOThread::CleanUp() { |
74 content::URLFetcher::CancelAll(); | 74 net::URLFetcher::CancelAll(); |
75 } | 75 } |
76 | 76 |
77 // Prepares the localized strings that are going to be displayed to | 77 // Prepares the localized strings that are going to be displayed to |
78 // the user if the service process dies. These strings are stored in the | 78 // the user if the service process dies. These strings are stored in the |
79 // environment block so they are accessible in the early stages of the | 79 // environment block so they are accessible in the early stages of the |
80 // chrome executable's lifetime. | 80 // chrome executable's lifetime. |
81 void PrepareRestartOnCrashEnviroment( | 81 void PrepareRestartOnCrashEnviroment( |
82 const CommandLine &parsed_command_line) { | 82 const CommandLine &parsed_command_line) { |
83 scoped_ptr<base::Environment> env(base::Environment::Create()); | 83 scoped_ptr<base::Environment> env(base::Environment::Create()); |
84 // Clear this var so child processes don't show the dialog by default. | 84 // Clear this var so child processes don't show the dialog by default. |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 if (enabled_services_ && !ipc_server_->is_client_connected()) { | 385 if (enabled_services_ && !ipc_server_->is_client_connected()) { |
386 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); | 386 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); |
387 } | 387 } |
388 ScheduleCloudPrintPolicyCheck(); | 388 ScheduleCloudPrintPolicyCheck(); |
389 } | 389 } |
390 | 390 |
391 ServiceProcess::~ServiceProcess() { | 391 ServiceProcess::~ServiceProcess() { |
392 Teardown(); | 392 Teardown(); |
393 g_service_process = NULL; | 393 g_service_process = NULL; |
394 } | 394 } |
OLD | NEW |