OLD | NEW |
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/gtk/gtk_hig_constants.h" | |
20 #include "ui/base/text/text_elider.h" | 19 #include "ui/base/text/text_elider.h" |
21 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/gfx/canvas_skia_paint.h" | 21 #include "ui/gfx/canvas_skia_paint.h" |
23 #include "ui/gfx/font.h" | 22 #include "ui/gfx/font.h" |
24 #include "ui/gfx/gtk_util.h" | 23 #include "ui/gfx/gtk_util.h" |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 // Spacing between the favicon and the text. | 27 // Spacing between the favicon and the text. |
29 const int kBarButtonPadding = 4; | 28 const int kBarButtonPadding = 4; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 if (provider->UsingNativeTheme()) { | 273 if (provider->UsingNativeTheme()) { |
275 gtk_util::SetLabelColor(label, NULL); | 274 gtk_util::SetLabelColor(label, NULL); |
276 } else { | 275 } else { |
277 GdkColor color = provider->GetGdkColor( | 276 GdkColor color = provider->GetGdkColor( |
278 ThemeService::COLOR_BOOKMARK_TEXT); | 277 ThemeService::COLOR_BOOKMARK_TEXT); |
279 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &color); | 278 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &color); |
280 gtk_widget_modify_fg(label, GTK_STATE_INSENSITIVE, &color); | 279 gtk_widget_modify_fg(label, GTK_STATE_INSENSITIVE, &color); |
281 | 280 |
282 // Because the prelight state is a white image that doesn't change by the | 281 // Because the prelight state is a white image that doesn't change by the |
283 // theme, force the text color to black when it would be used. | 282 // theme, force the text color to black when it would be used. |
284 gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &ui::kGdkBlack); | 283 gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, >k_util::kGdkBlack); |
285 gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &ui::kGdkBlack); | 284 gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, >k_util::kGdkBlack); |
286 } | 285 } |
287 } | 286 } |
288 | 287 |
289 // DnD-related ----------------------------------------------------------------- | 288 // DnD-related ----------------------------------------------------------------- |
290 | 289 |
291 int GetCodeMask(bool folder) { | 290 int GetCodeMask(bool folder) { |
292 int rv = ui::CHROME_BOOKMARK_ITEM; | 291 int rv = ui::CHROME_BOOKMARK_ITEM; |
293 if (!folder) { | 292 if (!folder) { |
294 rv |= ui::TEXT_URI_LIST | | 293 rv |= ui::TEXT_URI_LIST | |
295 ui::TEXT_HTML | | 294 ui::TEXT_HTML | |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 GURL url; | 438 GURL url; |
440 string16 title; | 439 string16 title; |
441 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) | 440 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) |
442 return false; | 441 return false; |
443 | 442 |
444 model->AddURL(parent, idx, title, url); | 443 model->AddURL(parent, idx, title, url); |
445 return true; | 444 return true; |
446 } | 445 } |
447 | 446 |
448 } // namespace bookmark_utils | 447 } // namespace bookmark_utils |
OLD | NEW |