| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/bookmark_table_view.h" | 5 #include "chrome/browser/views/bookmark_table_view.h" |
| 6 | 6 |
| 7 #include "base/base_drag_source.h" | 7 #include "base/base_drag_source.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_utils.h" | 8 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_table_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_table_model.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 BookmarkTableView::BookmarkTableView(Profile* profile, | 44 BookmarkTableView::BookmarkTableView(Profile* profile, |
| 45 BookmarkTableModel* model) | 45 BookmarkTableModel* model) |
| 46 : views::TableView(model, std::vector<views::TableColumn>(), | 46 : views::TableView(model, std::vector<views::TableColumn>(), |
| 47 views::ICON_AND_TEXT, false, true, true), | 47 views::ICON_AND_TEXT, false, true, true), |
| 48 profile_(profile), | 48 profile_(profile), |
| 49 show_path_column_(false) { | 49 show_path_column_(false) { |
| 50 UpdateColumns(); | 50 UpdateColumns(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // static | |
| 54 void BookmarkTableView::RegisterUserPrefs(PrefService* prefs) { | |
| 55 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth1, -1); | |
| 56 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth1, -1); | |
| 57 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth2, -1); | |
| 58 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth2, -1); | |
| 59 prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1); | |
| 60 } | |
| 61 | |
| 62 bool BookmarkTableView::CanDrop(const OSExchangeData& data) { | 53 bool BookmarkTableView::CanDrop(const OSExchangeData& data) { |
| 63 if (!parent_node_ || !profile_->GetBookmarkModel()->IsLoaded()) | 54 if (!parent_node_ || !profile_->GetBookmarkModel()->IsLoaded()) |
| 64 return false; | 55 return false; |
| 65 | 56 |
| 66 BookmarkDragData drag_data; | 57 BookmarkDragData drag_data; |
| 67 if (!drag_data.Read(data)) | 58 if (!drag_data.Read(data)) |
| 68 return false; | 59 return false; |
| 69 | 60 |
| 70 // Don't allow the user to drop an ancestor of the parent node onto the | 61 // Don't allow the user to drop an ancestor of the parent node onto the |
| 71 // parent node. This would create a cycle, which is definitely a no-no. | 62 // parent node. This would create a cycle, which is definitely a no-no. |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 GetClientRect(GetNativeControlHWND(), client_rect); | 434 GetClientRect(GetNativeControlHWND(), client_rect); |
| 444 ChromeFont font = GetAltTextFont(); | 435 ChromeFont font = GetAltTextFont(); |
| 445 // Pad height by 2 for halo. | 436 // Pad height by 2 for halo. |
| 446 return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, | 437 return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, |
| 447 std::max(kImageSize, font.height() + 2)); | 438 std::max(kImageSize, font.height() + 2)); |
| 448 } | 439 } |
| 449 | 440 |
| 450 ChromeFont BookmarkTableView::GetAltTextFont() { | 441 ChromeFont BookmarkTableView::GetAltTextFont() { |
| 451 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); | 442 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); |
| 452 } | 443 } |
| OLD | NEW |