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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { | 118 void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { |
119 PrefService* prefs = user_prefs::UserPrefs::Get(browser_context); | 119 PrefService* prefs = user_prefs::UserPrefs::Get(browser_context); |
120 const bool always_show = | 120 const bool always_show = |
121 !prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar); | 121 !prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar); |
122 | 122 |
123 // The user changed when the bookmark bar is shown, update the preferences. | 123 // The user changed when the bookmark bar is shown, update the preferences. |
124 prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, always_show); | 124 prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, always_show); |
125 } | 125 } |
126 | 126 |
127 base::string16 FormatBookmarkURLForDisplay(const GURL& url, | 127 base::string16 FormatBookmarkURLForDisplay(const GURL& url) { |
128 const PrefService* prefs) { | |
129 std::string languages; | |
130 if (prefs) | |
131 languages = prefs->GetString(prefs::kAcceptLanguages); | |
132 | |
133 // Because this gets re-parsed by FixupURL(), it's safe to omit the scheme | 128 // 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 | 129 // and trailing slash, and unescape most characters. However, it's |
135 // important not to drop any username/password, or unescape anything that | 130 // important not to drop any username/password, or unescape anything that |
136 // changes the URL's meaning. | 131 // changes the URL's meaning. |
137 return url_formatter::FormatUrl( | 132 return url_formatter::FormatUrl( |
138 url, languages, url_formatter::kFormatUrlOmitAll & | 133 url, url_formatter::kFormatUrlOmitAll & |
139 ~url_formatter::kFormatUrlOmitUsernamePassword, | 134 ~url_formatter::kFormatUrlOmitUsernamePassword, |
140 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); | 135 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
141 } | 136 } |
142 | 137 |
143 bool IsAppsShortcutEnabled(Profile* profile) { | 138 bool IsAppsShortcutEnabled(Profile* profile) { |
144 // Legacy supervised users can not have apps installed currently so there's no | 139 // Legacy supervised users can not have apps installed currently so there's no |
145 // need to show the apps shortcut. | 140 // need to show the apps shortcut. |
146 if (profile->IsLegacySupervised()) | 141 if (profile->IsLegacySupervised()) |
147 return false; | 142 return false; |
148 | 143 |
149 #if defined(USE_ASH) | 144 #if defined(USE_ASH) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 312 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
318 IDR_BOOKMARK_BAR_FOLDER_MANAGED); | 313 IDR_BOOKMARK_BAR_FOLDER_MANAGED); |
319 } | 314 } |
320 #endif | 315 #endif |
321 | 316 |
322 return GetFolderIcon(gfx::VectorIconId::FOLDER_MANAGED, text_color); | 317 return GetFolderIcon(gfx::VectorIconId::FOLDER_MANAGED, text_color); |
323 } | 318 } |
324 #endif | 319 #endif |
325 | 320 |
326 } // namespace chrome | 321 } // namespace chrome |
OLD | NEW |