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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 while (iterator.has_next()) { | 288 while (iterator.has_next()) { |
289 const GURL* url = iterator.NextURL(); | 289 const GURL* url = iterator.NextURL(); |
290 if (IsURLAllowedInIncognito(*url, browser_context)) | 290 if (IsURLAllowedInIncognito(*url, browser_context)) |
291 return true; | 291 return true; |
292 } | 292 } |
293 return false; | 293 return false; |
294 } | 294 } |
295 | 295 |
296 GURL GetURLToBookmark(content::WebContents* web_contents) { | 296 GURL GetURLToBookmark(content::WebContents* web_contents) { |
297 DCHECK(web_contents); | 297 DCHECK(web_contents); |
298 return IsInstantNTP(web_contents) ? | 298 return search::IsInstantNTP(web_contents) ? GURL(kChromeUINewTabURL) |
299 GURL(kChromeUINewTabURL) : web_contents->GetURL(); | 299 : web_contents->GetURL(); |
300 } | 300 } |
301 | 301 |
302 void GetURLAndTitleToBookmark(content::WebContents* web_contents, | 302 void GetURLAndTitleToBookmark(content::WebContents* web_contents, |
303 GURL* url, | 303 GURL* url, |
304 base::string16* title) { | 304 base::string16* title) { |
305 *url = GetURLToBookmark(web_contents); | 305 *url = GetURLToBookmark(web_contents); |
306 *title = web_contents->GetTitle(); | 306 *title = web_contents->GetTitle(); |
307 } | 307 } |
308 | 308 |
309 void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { | 309 void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { |
(...skipping 25 matching lines...) Expand all Loading... |
335 chrome::HostDesktopType host_desktop_type) { | 335 chrome::HostDesktopType host_desktop_type) { |
336 // Legacy supervised users can not have apps installed currently so there's no | 336 // Legacy supervised users can not have apps installed currently so there's no |
337 // need to show the apps shortcut. | 337 // need to show the apps shortcut. |
338 if (profile->IsLegacySupervised()) | 338 if (profile->IsLegacySupervised()) |
339 return false; | 339 return false; |
340 | 340 |
341 // Don't show the apps shortcut in ash since the app launcher is enabled. | 341 // Don't show the apps shortcut in ash since the app launcher is enabled. |
342 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 342 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
343 return false; | 343 return false; |
344 | 344 |
345 return chrome::IsInstantExtendedAPIEnabled() && !profile->IsOffTheRecord(); | 345 return search::IsInstantExtendedAPIEnabled() && !profile->IsOffTheRecord(); |
346 } | 346 } |
347 | 347 |
348 bool ShouldShowAppsShortcutInBookmarkBar( | 348 bool ShouldShowAppsShortcutInBookmarkBar( |
349 Profile* profile, | 349 Profile* profile, |
350 chrome::HostDesktopType host_desktop_type) { | 350 chrome::HostDesktopType host_desktop_type) { |
351 return IsAppsShortcutEnabled(profile, host_desktop_type) && | 351 return IsAppsShortcutEnabled(profile, host_desktop_type) && |
352 profile->GetPrefs()->GetBoolean( | 352 profile->GetPrefs()->GetBoolean( |
353 bookmarks::prefs::kShowAppsShortcutInBookmarkBar); | 353 bookmarks::prefs::kShowAppsShortcutInBookmarkBar); |
354 } | 354 } |
355 | 355 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (drop_parent->HasAncestor(node)) | 475 if (drop_parent->HasAncestor(node)) |
476 return false; | 476 return false; |
477 } | 477 } |
478 return true; | 478 return true; |
479 } | 479 } |
480 // From another profile, always accept. | 480 // From another profile, always accept. |
481 return true; | 481 return true; |
482 } | 482 } |
483 | 483 |
484 } // namespace chrome | 484 } // namespace chrome |
OLD | NEW |