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/ui/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 // Because this gets re-parsed by FixupURL(), it's safe to omit the scheme | 133 // Because this gets re-parsed by FixupURL(), it's safe to omit the scheme |
| 134 // and trailing slash, and unescape most characters. However, it's | 134 // and trailing slash, and unescape most characters. However, it's |
| 135 // important not to drop any username/password, or unescape anything that | 135 // important not to drop any username/password, or unescape anything that |
| 136 // changes the URL's meaning. | 136 // changes the URL's meaning. |
| 137 return url_formatter::FormatUrl( | 137 return url_formatter::FormatUrl( |
| 138 url, languages, url_formatter::kFormatUrlOmitAll & | 138 url, languages, url_formatter::kFormatUrlOmitAll & |
| 139 ~url_formatter::kFormatUrlOmitUsernamePassword, | 139 ~url_formatter::kFormatUrlOmitUsernamePassword, |
| 140 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); | 140 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
| 141 } | 141 } |
| 142 | 142 |
| 143 bool IsAppsShortcutEnabled(Profile* profile, | 143 bool IsAppsShortcutEnabled(Profile* profile) { |
| 144 chrome::HostDesktopType host_desktop_type) { | |
| 145 // Legacy supervised users can not have apps installed currently so there's no | 144 // Legacy supervised users can not have apps installed currently so there's no |
| 146 // need to show the apps shortcut. | 145 // need to show the apps shortcut. |
| 147 if (profile->IsLegacySupervised()) | 146 if (profile->IsLegacySupervised()) |
| 148 return false; | 147 return false; |
| 149 | 148 |
| 149 #if defined(USE_ASH) | |
| 150 // Don't show the apps shortcut in ash since the app launcher is enabled. | 150 // Don't show the apps shortcut in ash since the app launcher is enabled. |
| 151 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 151 return false; |
| 152 return false; | 152 #endif |
|
sky
2016/02/16 02:58:04
Similar comment about #else.
scottmg
2016/02/17 03:12:33
Done.
| |
| 153 | 153 |
| 154 return search::IsInstantExtendedAPIEnabled() && !profile->IsOffTheRecord(); | 154 return search::IsInstantExtendedAPIEnabled() && !profile->IsOffTheRecord(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool ShouldShowAppsShortcutInBookmarkBar( | 157 bool ShouldShowAppsShortcutInBookmarkBar(Profile* profile) { |
| 158 Profile* profile, | 158 return IsAppsShortcutEnabled(profile) && |
| 159 chrome::HostDesktopType host_desktop_type) { | |
| 160 return IsAppsShortcutEnabled(profile, host_desktop_type) && | |
| 161 profile->GetPrefs()->GetBoolean( | 159 profile->GetPrefs()->GetBoolean( |
| 162 bookmarks::prefs::kShowAppsShortcutInBookmarkBar); | 160 bookmarks::prefs::kShowAppsShortcutInBookmarkBar); |
| 163 } | 161 } |
| 164 | 162 |
| 165 bool ShouldRemoveBookmarkThisPageUI(Profile* profile) { | 163 bool ShouldRemoveBookmarkThisPageUI(Profile* profile) { |
| 166 return GetBookmarkShortcutDisposition(profile) == | 164 return GetBookmarkShortcutDisposition(profile) == |
| 167 BOOKMARK_SHORTCUT_DISPOSITION_REMOVED; | 165 BOOKMARK_SHORTCUT_DISPOSITION_REMOVED; |
| 168 } | 166 } |
| 169 | 167 |
| 170 bool ShouldRemoveBookmarkOpenPagesUI(Profile* profile) { | 168 bool ShouldRemoveBookmarkOpenPagesUI(Profile* profile) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 317 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 320 IDR_BOOKMARK_BAR_FOLDER_MANAGED); | 318 IDR_BOOKMARK_BAR_FOLDER_MANAGED); |
| 321 } | 319 } |
| 322 #endif | 320 #endif |
| 323 | 321 |
| 324 return GetFolderIcon(gfx::VectorIconId::FOLDER_MANAGED, text_color); | 322 return GetFolderIcon(gfx::VectorIconId::FOLDER_MANAGED, text_color); |
| 325 } | 323 } |
| 326 #endif | 324 #endif |
| 327 | 325 |
| 328 } // namespace chrome | 326 } // namespace chrome |
| OLD | NEW |