Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_utils.cc

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search/search.h" 13 #include "chrome/browser/search/search.h"
14 #include "chrome/browser/ui/app_list/app_list_util.h" 14 #include "chrome/browser/ui/app_list/app_list_util.h"
15 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" 15 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_navigator.h" 17 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/simple_message_box.h" 19 #include "chrome/browser/ui/simple_message_box.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "chrome/grit/chromium_strings.h" 23 #include "chrome/grit/chromium_strings.h"
24 #include "chrome/grit/generated_resources.h" 24 #include "chrome/grit/generated_resources.h"
25 #include "components/bookmarks/browser/bookmark_model.h" 25 #include "components/bookmarks/browser/bookmark_model.h"
26 #include "components/bookmarks/browser/bookmark_node_data.h" 26 #include "components/bookmarks/browser/bookmark_node_data.h"
27 #include "components/search/search.h" 27 #include "components/search/search.h"
28 #include "components/url_formatter/url_formatter.h"
28 #include "components/user_prefs/user_prefs.h" 29 #include "components/user_prefs/user_prefs.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "net/base/net_util.h"
31 #include "ui/base/dragdrop/drag_drop_types.h" 31 #include "ui/base/dragdrop/drag_drop_types.h"
32 #include "ui/base/dragdrop/drop_target_event.h" 32 #include "ui/base/dragdrop/drop_target_event.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 34
35 #if defined(ENABLE_EXTENSIONS) 35 #if defined(ENABLE_EXTENSIONS)
36 #include "chrome/browser/extensions/api/commands/command_service.h" 36 #include "chrome/browser/extensions/api/commands/command_service.h"
37 #include "extensions/browser/extension_registry.h" 37 #include "extensions/browser/extension_registry.h"
38 #include "extensions/common/extension_set.h" 38 #include "extensions/common/extension_set.h"
39 #endif 39 #endif
40 40
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 base::string16 FormatBookmarkURLForDisplay(const GURL& url, 318 base::string16 FormatBookmarkURLForDisplay(const GURL& url,
319 const PrefService* prefs) { 319 const PrefService* prefs) {
320 std::string languages; 320 std::string languages;
321 if (prefs) 321 if (prefs)
322 languages = prefs->GetString(prefs::kAcceptLanguages); 322 languages = prefs->GetString(prefs::kAcceptLanguages);
323 323
324 // Because this gets re-parsed by FixupURL(), it's safe to omit the scheme 324 // Because this gets re-parsed by FixupURL(), it's safe to omit the scheme
325 // and trailing slash, and unescape most characters. However, it's 325 // and trailing slash, and unescape most characters. However, it's
326 // important not to drop any username/password, or unescape anything that 326 // important not to drop any username/password, or unescape anything that
327 // changes the URL's meaning. 327 // changes the URL's meaning.
328 return net::FormatUrl( 328 return url_formatter::FormatUrl(
329 url, languages, 329 url, languages, url_formatter::kFormatUrlOmitAll &
330 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, 330 ~url_formatter::kFormatUrlOmitUsernamePassword,
331 net::UnescapeRule::SPACES, NULL, NULL, NULL); 331 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr);
332 } 332 }
333 333
334 bool IsAppsShortcutEnabled(Profile* profile, 334 bool IsAppsShortcutEnabled(Profile* profile,
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.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_utils.h ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698