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_manager_view.h" | 5 #include "chrome/browser/views/bookmark_manager_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/gfx/skia_utils.h" | |
10 #include "chrome/app/locales/locale_settings.h" | 9 #include "chrome/app/locales/locale_settings.h" |
11 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" |
12 #include "chrome/browser/bookmarks/bookmark_html_writer.h" | 11 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
13 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
14 #include "chrome/browser/bookmarks/bookmark_table_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_table_model.h" |
15 #include "chrome/browser/bookmarks/bookmark_utils.h" | 14 #include "chrome/browser/bookmarks/bookmark_utils.h" |
16 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
17 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/importer/importer.h" | 17 #include "chrome/browser/importer/importer.h" |
19 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
20 #include "chrome/browser/user_metrics.h" | 19 #include "chrome/browser/user_metrics.h" |
21 #include "chrome/browser/views/bookmark_editor_view.h" | 20 #include "chrome/browser/views/bookmark_editor_view.h" |
22 #include "chrome/browser/views/bookmark_folder_tree_view.h" | 21 #include "chrome/browser/views/bookmark_folder_tree_view.h" |
23 #include "chrome/browser/views/bookmark_table_view.h" | 22 #include "chrome/browser/views/bookmark_table_view.h" |
24 #include "chrome/browser/views/standard_layout.h" | 23 #include "chrome/browser/views/standard_layout.h" |
25 #include "chrome/common/gfx/chrome_canvas.h" | 24 #include "chrome/common/gfx/chrome_canvas.h" |
26 #include "chrome/common/gfx/color_utils.h" | 25 #include "chrome/common/gfx/color_utils.h" |
27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/pref_service.h" | 27 #include "chrome/common/pref_service.h" |
29 #include "chrome/common/win_util.h" | 28 #include "chrome/common/win_util.h" |
30 #include "chrome/views/grid_layout.h" | 29 #include "chrome/views/grid_layout.h" |
31 #include "chrome/views/menu_button.h" | 30 #include "chrome/views/menu_button.h" |
32 #include "chrome/views/single_split_view.h" | 31 #include "chrome/views/single_split_view.h" |
33 #include "chrome/views/window.h" | 32 #include "chrome/views/window.h" |
34 | |
35 #include "generated_resources.h" | 33 #include "generated_resources.h" |
| 34 #include "skia/ext/skia_utils.h" |
36 | 35 |
37 // If non-null, there is an open editor and this is the window it is contained | 36 // If non-null, there is an open editor and this is the window it is contained |
38 // in it. | 37 // in it. |
39 static views::Window* open_window = NULL; | 38 static views::Window* open_window = NULL; |
40 // And this is the manager contained in it. | 39 // And this is the manager contained in it. |
41 static BookmarkManagerView* manager = NULL; | 40 static BookmarkManagerView* manager = NULL; |
42 | 41 |
43 // Delay, in ms, between when the user types and when we run the search. | 42 // Delay, in ms, between when the user types and when we run the search. |
44 static const int kSearchDelayMS = 200; | 43 static const int kSearchDelayMS = 200; |
45 | 44 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // TableViews iterator iterates in reverse order. Reverse the nodes so they | 291 // TableViews iterator iterates in reverse order. Reverse the nodes so they |
293 // are opened in visual order. | 292 // are opened in visual order. |
294 std::reverse(nodes.begin(), nodes.end()); | 293 std::reverse(nodes.begin(), nodes.end()); |
295 return nodes; | 294 return nodes; |
296 } | 295 } |
297 | 296 |
298 void BookmarkManagerView::PaintBackground(ChromeCanvas* canvas) { | 297 void BookmarkManagerView::PaintBackground(ChromeCanvas* canvas) { |
299 canvas->drawColor(kBackgroundColorBottom, SkPorterDuff::kSrc_Mode); | 298 canvas->drawColor(kBackgroundColorBottom, SkPorterDuff::kSrc_Mode); |
300 | 299 |
301 SkPaint paint; | 300 SkPaint paint; |
302 paint.setShader(gfx::CreateGradientShader(0, kBackgroundGradientHeight, | 301 paint.setShader(skia::CreateGradientShader(0, kBackgroundGradientHeight, |
303 kBackgroundColorTop, | 302 kBackgroundColorTop, |
304 kBackgroundColorBottom))->safeUnref(); | 303 kBackgroundColorBottom))->safeUnref(); |
305 canvas->FillRectInt(0, 0, width(), kBackgroundGradientHeight, paint); | 304 canvas->FillRectInt(0, 0, width(), kBackgroundGradientHeight, paint); |
306 } | 305 } |
307 | 306 |
308 gfx::Size BookmarkManagerView::GetPreferredSize() { | 307 gfx::Size BookmarkManagerView::GetPreferredSize() { |
309 return gfx::Size(views::Window::GetLocalizedContentsSize( | 308 return gfx::Size(views::Window::GetLocalizedContentsSize( |
310 IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS, | 309 IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS, |
311 IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES)); | 310 IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES)); |
312 } | 311 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 if (select_file_dialog_.get()) | 702 if (select_file_dialog_.get()) |
704 select_file_dialog_->ListenerDestroyed(); | 703 select_file_dialog_->ListenerDestroyed(); |
705 | 704 |
706 select_file_dialog_ = SelectFileDialog::Create(this); | 705 select_file_dialog_ = SelectFileDialog::Create(this); |
707 select_file_dialog_->SelectFile( | 706 select_file_dialog_->SelectFile( |
708 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html", | 707 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html", |
709 win_util::GetFileFilterFromPath(L"bookmarks.html"), L"html", | 708 win_util::GetFileFilterFromPath(L"bookmarks.html"), L"html", |
710 GetWidget()->GetHWND(), | 709 GetWidget()->GetHWND(), |
711 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); | 710 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); |
712 } | 711 } |
OLD | NEW |