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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc

Issue 7669040: content: Move render_widget_host_view_gtk to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chromeos fix. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/base/dragdrop/gtk_dnd_util.h" 18 #include "ui/base/dragdrop/gtk_dnd_util.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/text/text_elider.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/canvas_skia_paint.h" 21 #include "ui/gfx/canvas_skia_paint.h"
22 #include "ui/gfx/font.h" 22 #include "ui/gfx/font.h"
23 #include "ui/gfx/gtk_util.h" 23 #include "ui/gfx/gtk_util.h"
24 24
25 namespace { 25 namespace {
26 26
27 // Spacing between the favicon and the text. 27 // Spacing between the favicon and the text.
28 const int kBarButtonPadding = 4; 28 const int kBarButtonPadding = 4;
29 29
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (node->is_folder()) 246 if (node->is_folder())
247 return std::string(); 247 return std::string();
248 248
249 return gtk_util::BuildTooltipTitleFor(node->GetTitle(), node->url()); 249 return gtk_util::BuildTooltipTitleFor(node->GetTitle(), node->url());
250 } 250 }
251 251
252 std::string BuildMenuLabelFor(const BookmarkNode* node) { 252 std::string BuildMenuLabelFor(const BookmarkNode* node) {
253 // This breaks on word boundaries. Ideally we would break on character 253 // This breaks on word boundaries. Ideally we would break on character
254 // boundaries. 254 // boundaries.
255 std::string elided_name = UTF16ToUTF8( 255 std::string elided_name = UTF16ToUTF8(
256 l10n_util::TruncateString(node->GetTitle(), kMaxCharsOnAMenuLabel)); 256 ui::TruncateString(node->GetTitle(), kMaxCharsOnAMenuLabel));
257 257
258 if (elided_name.empty()) { 258 if (elided_name.empty()) {
259 elided_name = UTF16ToUTF8(l10n_util::TruncateString( 259 elided_name = UTF16ToUTF8(ui::TruncateString(
260 UTF8ToUTF16(node->url().possibly_invalid_spec()), 260 UTF8ToUTF16(node->url().possibly_invalid_spec()),
261 kMaxCharsOnAMenuLabel)); 261 kMaxCharsOnAMenuLabel));
262 } 262 }
263 263
264 return elided_name; 264 return elided_name;
265 } 265 }
266 266
267 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget) { 267 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget) {
268 return reinterpret_cast<const BookmarkNode*>( 268 return reinterpret_cast<const BookmarkNode*>(
269 g_object_get_data(G_OBJECT(widget), bookmark_utils::kBookmarkNode)); 269 g_object_get_data(G_OBJECT(widget), bookmark_utils::kBookmarkNode));
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 GURL url; 438 GURL url;
439 string16 title; 439 string16 title;
440 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) 440 if (!ui::ExtractNetscapeURL(selection_data, &url, &title))
441 return false; 441 return false;
442 442
443 model->AddURL(parent, idx, title, url); 443 model->AddURL(parent, idx, title, url);
444 return true; 444 return true;
445 } 445 }
446 446
447 } // namespace bookmark_utils 447 } // namespace bookmark_utils
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h ('k') | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698