| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // and trailing slash, and unescape most characters. However, it's | 347 // and trailing slash, and unescape most characters. However, it's |
| 348 // important not to drop any username/password, or unescape anything that | 348 // important not to drop any username/password, or unescape anything that |
| 349 // changes the URL's meaning. | 349 // changes the URL's meaning. |
| 350 return url_formatter::FormatUrl( | 350 return url_formatter::FormatUrl( |
| 351 url, languages, url_formatter::kFormatUrlOmitAll & | 351 url, languages, url_formatter::kFormatUrlOmitAll & |
| 352 ~url_formatter::kFormatUrlOmitUsernamePassword, | 352 ~url_formatter::kFormatUrlOmitUsernamePassword, |
| 353 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); | 353 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool IsAppsShortcutEnabled(Profile* profile, | 356 bool IsAppsShortcutEnabled(Profile* profile, |
| 357 chrome::HostDesktopType host_desktop_type) { | 357 ui::HostDesktopType host_desktop_type) { |
| 358 // Legacy supervised users can not have apps installed currently so there's no | 358 // Legacy supervised users can not have apps installed currently so there's no |
| 359 // need to show the apps shortcut. | 359 // need to show the apps shortcut. |
| 360 if (profile->IsLegacySupervised()) | 360 if (profile->IsLegacySupervised()) |
| 361 return false; | 361 return false; |
| 362 | 362 |
| 363 // Don't show the apps shortcut in ash since the app launcher is enabled. | 363 // Don't show the apps shortcut in ash since the app launcher is enabled. |
| 364 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 364 if (host_desktop_type == ui::HOST_DESKTOP_TYPE_ASH) |
| 365 return false; | 365 return false; |
| 366 | 366 |
| 367 return search::IsInstantExtendedAPIEnabled() && !profile->IsOffTheRecord(); | 367 return search::IsInstantExtendedAPIEnabled() && !profile->IsOffTheRecord(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool ShouldShowAppsShortcutInBookmarkBar( | 370 bool ShouldShowAppsShortcutInBookmarkBar( |
| 371 Profile* profile, | 371 Profile* profile, |
| 372 chrome::HostDesktopType host_desktop_type) { | 372 ui::HostDesktopType host_desktop_type) { |
| 373 return IsAppsShortcutEnabled(profile, host_desktop_type) && | 373 return IsAppsShortcutEnabled(profile, host_desktop_type) && |
| 374 profile->GetPrefs()->GetBoolean( | 374 profile->GetPrefs()->GetBoolean( |
| 375 bookmarks::prefs::kShowAppsShortcutInBookmarkBar); | 375 bookmarks::prefs::kShowAppsShortcutInBookmarkBar); |
| 376 } | 376 } |
| 377 | 377 |
| 378 bool ShouldRemoveBookmarkThisPageUI(Profile* profile) { | 378 bool ShouldRemoveBookmarkThisPageUI(Profile* profile) { |
| 379 return GetBookmarkShortcutDisposition(profile) == | 379 return GetBookmarkShortcutDisposition(profile) == |
| 380 BOOKMARK_SHORTCUT_DISPOSITION_REMOVED; | 380 BOOKMARK_SHORTCUT_DISPOSITION_REMOVED; |
| 381 } | 381 } |
| 382 | 382 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 532 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 533 IDR_BOOKMARK_BAR_FOLDER_MANAGED); | 533 IDR_BOOKMARK_BAR_FOLDER_MANAGED); |
| 534 } | 534 } |
| 535 #endif | 535 #endif |
| 536 | 536 |
| 537 return GetFolderIcon(gfx::VectorIconId::FOLDER_MANAGED); | 537 return GetFolderIcon(gfx::VectorIconId::FOLDER_MANAGED); |
| 538 } | 538 } |
| 539 #endif | 539 #endif |
| 540 | 540 |
| 541 } // namespace chrome | 541 } // namespace chrome |
| OLD | NEW |