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