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/browser/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/thread_task_runner_handle.h" |
13 #include "chrome/browser/lifetime/application_lifetime.h" | 15 #include "chrome/browser/lifetime/application_lifetime.h" |
14 #include "chrome/browser/ui/browser_dialogs.h" | 16 #include "chrome/browser/ui/browser_dialogs.h" |
15 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
17 #include "components/url_fixer/url_fixer.h" | 19 #include "components/url_fixer/url_fixer.h" |
18 | 20 |
19 bool FixupBrowserAboutURL(GURL* url, | 21 bool FixupBrowserAboutURL(GURL* url, |
20 content::BrowserContext* browser_context) { | 22 content::BrowserContext* browser_context) { |
21 // Ensure that any cleanup done by FixupURL happens before the rewriting | 23 // Ensure that any cleanup done by FixupURL happens before the rewriting |
22 // phase that determines the virtual URL, by including it in an initial | 24 // phase that determines the virtual URL, by including it in an initial |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Having re-written the URL, make the chrome: handler process it. | 101 // Having re-written the URL, make the chrome: handler process it. |
100 return false; | 102 return false; |
101 } | 103 } |
102 | 104 |
103 bool HandleNonNavigationAboutURL(const GURL& url) { | 105 bool HandleNonNavigationAboutURL(const GURL& url) { |
104 const std::string spec(url.spec()); | 106 const std::string spec(url.spec()); |
105 | 107 |
106 if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) { | 108 if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) { |
107 // Call AttemptRestart after chrome::Navigate() completes to avoid access of | 109 // Call AttemptRestart after chrome::Navigate() completes to avoid access of |
108 // gtk objects after they are destroyed by BrowserWindowGtk::Close(). | 110 // gtk objects after they are destroyed by BrowserWindowGtk::Close(). |
109 base::MessageLoop::current()->PostTask(FROM_HERE, | 111 base::ThreadTaskRunnerHandle::Get()->PostTask( |
110 base::Bind(&chrome::AttemptRestart)); | 112 FROM_HERE, base::Bind(&chrome::AttemptRestart)); |
111 return true; | 113 return true; |
112 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { | 114 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
113 base::MessageLoop::current()->PostTask(FROM_HERE, | 115 base::ThreadTaskRunnerHandle::Get()->PostTask( |
114 base::Bind(&chrome::AttemptExit)); | 116 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
115 return true; | 117 return true; |
116 } | 118 } |
117 | 119 |
118 return false; | 120 return false; |
119 } | 121 } |
OLD | NEW |