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/gtk/bookmarks/bookmark_utils_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 12 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
13 #include "chrome/browser/bookmarks/bookmark_utils.h" | 13 #include "chrome/browser/bookmarks/bookmark_utils.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 15 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "grit/ui_strings.h" |
| 19 #include "net/base/net_util.h" |
18 #include "ui/base/dragdrop/gtk_dnd_util.h" | 20 #include "ui/base/dragdrop/gtk_dnd_util.h" |
19 #include "ui/base/gtk/gtk_hig_constants.h" | 21 #include "ui/base/gtk/gtk_hig_constants.h" |
20 #include "ui/base/gtk/gtk_screen_util.h" | 22 #include "ui/base/gtk/gtk_screen_util.h" |
| 23 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/base/text/text_elider.h" | 25 #include "ui/base/text/text_elider.h" |
23 #include "ui/gfx/canvas_skia_paint.h" | 26 #include "ui/gfx/canvas_skia_paint.h" |
24 #include "ui/gfx/font.h" | 27 #include "ui/gfx/font.h" |
25 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
26 | 29 |
27 namespace { | 30 namespace { |
28 | 31 |
29 // Spacing between the favicon and the text. | 32 // Spacing between the favicon and the text. |
30 const int kBarButtonPadding = 4; | 33 const int kBarButtonPadding = 4; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 BookmarkModel* model, const BookmarkNode* parent, int idx) { | 452 BookmarkModel* model, const BookmarkNode* parent, int idx) { |
450 GURL url; | 453 GURL url; |
451 string16 title; | 454 string16 title; |
452 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) | 455 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) |
453 return false; | 456 return false; |
454 | 457 |
455 model->AddURL(parent, idx, title, url); | 458 model->AddURL(parent, idx, title, url); |
456 return true; | 459 return true; |
457 } | 460 } |
458 | 461 |
| 462 string16 GetNameForURL(const GURL& url) { |
| 463 if (url.is_valid()) { |
| 464 return net::GetSuggestedFilename(url, "", "", "", "", std::string()); |
| 465 } else { |
| 466 return l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); |
| 467 } |
| 468 } |
| 469 |
459 } // namespace bookmark_utils | 470 } // namespace bookmark_utils |
OLD | NEW |