Chromium Code Reviews| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 parsed_command_line().HasSwitch(switches::kShowIcons)) { | 1151 parsed_command_line().HasSwitch(switches::kShowIcons)) { |
| 1152 return ChromeBrowserMainPartsWin::HandleIconsCommands( | 1152 return ChromeBrowserMainPartsWin::HandleIconsCommands( |
| 1153 parsed_command_line_); | 1153 parsed_command_line_); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 ui::SelectFileDialog::SetFactory(new ChromeSelectFileDialogFactory( | 1156 ui::SelectFileDialog::SetFactory(new ChromeSelectFileDialogFactory( |
| 1157 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 1157 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 1158 #endif // defined(OS_WIN) | 1158 #endif // defined(OS_WIN) |
| 1159 | 1159 |
| 1160 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { | 1160 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { |
| 1161 return ShellIntegration::SetAsDefaultBrowser() ? | 1161 bool is_managed = g_browser_process->local_state()->IsManagedPreference( |
| 1162 prefs::kDefaultBrowserSettingEnabled); | |
| 1163 if (!is_managed || g_browser_process->local_state()->GetBoolean( | |
|
pastarmovj
2015/03/19 09:49:28
One last suggestion i got is to reverse the if con
peletskyi
2015/03/20 10:10:37
Done.
| |
| 1164 prefs::kDefaultBrowserSettingEnabled)) { | |
| 1165 return ShellIntegration::SetAsDefaultBrowser() ? | |
| 1162 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : | 1166 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : |
| 1163 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); | 1167 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); |
| 1168 } | |
| 1169 return static_cast<int>(chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY); | |
| 1164 } | 1170 } |
| 1165 | 1171 |
| 1166 #if defined(USE_AURA) | 1172 #if defined(USE_AURA) |
| 1167 // Make sure aura::Env has been initialized. | 1173 // Make sure aura::Env has been initialized. |
| 1168 CHECK(aura::Env::GetInstance()); | 1174 CHECK(aura::Env::GetInstance()); |
| 1169 #endif // defined(USE_AURA) | 1175 #endif // defined(USE_AURA) |
| 1170 | 1176 |
| 1171 // Android doesn't support extensions and doesn't implement ProcessSingleton. | 1177 // Android doesn't support extensions and doesn't implement ProcessSingleton. |
| 1172 #if !defined(OS_ANDROID) | 1178 #if !defined(OS_ANDROID) |
| 1173 // If the command line specifies --pack-extension, attempt the pack extension | 1179 // If the command line specifies --pack-extension, attempt the pack extension |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1728 chromeos::CrosSettings::Shutdown(); | 1734 chromeos::CrosSettings::Shutdown(); |
| 1729 #endif // defined(OS_CHROMEOS) | 1735 #endif // defined(OS_CHROMEOS) |
| 1730 #endif // defined(OS_ANDROID) | 1736 #endif // defined(OS_ANDROID) |
| 1731 } | 1737 } |
| 1732 | 1738 |
| 1733 // Public members: | 1739 // Public members: |
| 1734 | 1740 |
| 1735 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1741 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1736 chrome_extra_parts_.push_back(parts); | 1742 chrome_extra_parts_.push_back(parts); |
| 1737 } | 1743 } |
| OLD | NEW |