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

Side by Side Diff: chrome/browser/views/bookmark_manager_view.cc

Issue 118150: Linux bookmark manager first cut. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 1 more file Created 11 years, 6 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
« no previous file with comments | « chrome/browser/views/bookmark_manager_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/gfx/canvas.h" 9 #include "app/gfx/canvas.h"
10 #include "app/gfx/color_utils.h" 10 #include "app/gfx/color_utils.h"
11 #include "app/l10n_util.h" 11 #include "app/l10n_util.h"
12 #include "base/thread.h" 12 #include "base/thread.h"
13 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" 13 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h"
14 #include "chrome/browser/bookmarks/bookmark_html_writer.h" 14 #include "chrome/browser/bookmarks/bookmark_html_writer.h"
15 #include "chrome/browser/bookmarks/bookmark_manager.h"
15 #include "chrome/browser/bookmarks/bookmark_model.h" 16 #include "chrome/browser/bookmarks/bookmark_model.h"
16 #include "chrome/browser/bookmarks/bookmark_table_model.h" 17 #include "chrome/browser/bookmarks/bookmark_table_model.h"
17 #include "chrome/browser/bookmarks/bookmark_utils.h" 18 #include "chrome/browser/bookmarks/bookmark_utils.h"
18 #include "chrome/browser/browser_list.h" 19 #include "chrome/browser/browser_list.h"
19 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/importer/importer.h" 21 #include "chrome/browser/importer/importer.h"
21 #include "chrome/browser/metrics/user_metrics.h" 22 #include "chrome/browser/metrics/user_metrics.h"
22 #include "chrome/browser/profile.h" 23 #include "chrome/browser/profile.h"
23 #include "chrome/browser/views/bookmark_editor_view.h" 24 #include "chrome/browser/views/bookmark_editor_view.h"
24 #include "chrome/browser/views/bookmark_folder_tree_view.h" 25 #include "chrome/browser/views/bookmark_folder_tree_view.h"
25 #include "chrome/browser/views/bookmark_table_view.h" 26 #include "chrome/browser/views/bookmark_table_view.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
27 #include "chrome/common/pref_service.h" 28 #include "chrome/common/pref_service.h"
28 #include "grit/generated_resources.h" 29 #include "grit/generated_resources.h"
29 #include "grit/locale_settings.h" 30 #include "grit/locale_settings.h"
30 #include "skia/ext/skia_utils.h" 31 #include "skia/ext/skia_utils.h"
31 #include "views/grid_layout.h" 32 #include "views/grid_layout.h"
32 #include "views/controls/button/menu_button.h" 33 #include "views/controls/button/menu_button.h"
33 #include "views/controls/label.h" 34 #include "views/controls/label.h"
34 #include "views/controls/single_split_view.h" 35 #include "views/controls/single_split_view.h"
35 #include "views/standard_layout.h" 36 #include "views/standard_layout.h"
36 #include "views/widget/widget.h" 37 #include "views/widget/widget.h"
37 #include "views/window/window.h" 38 #include "views/window/window.h"
38 39
39
40 // If non-null, there is an open editor and this is the window it is contained 40 // If non-null, there is an open editor and this is the window it is contained
41 // in it. 41 // in it.
42 static views::Window* open_window = NULL; 42 static views::Window* open_window = NULL;
43 // And this is the manager contained in it. 43 // And this is the manager contained in it.
44 static BookmarkManagerView* manager = NULL; 44 static BookmarkManagerView* manager = NULL;
45 45
46 // Delay, in ms, between when the user types and when we run the search. 46 // Delay, in ms, between when the user types and when we run the search.
47 static const int kSearchDelayMS = 200; 47 static const int kSearchDelayMS = 200;
48 48
49 static const int kOrganizeMenuButtonID = 1; 49 static const int kOrganizeMenuButtonID = 1;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 namespace browser { 137 namespace browser {
138 138
139 // Declared in browser_dialogs.h so others don't need to depend on our header. 139 // Declared in browser_dialogs.h so others don't need to depend on our header.
140 void ShowBookmarkManagerView(Profile* profile) { 140 void ShowBookmarkManagerView(Profile* profile) {
141 BookmarkManagerView::Show(profile); 141 BookmarkManagerView::Show(profile);
142 } 142 }
143 143
144 } // namespace browser 144 } // namespace browser
145 145
146 // BookmarkManager -------------------------------------------------------------
147
148 void BookmarkManager::SelectInTree(Profile* profile, BookmarkNode* node) {
149 if (manager && manager->profile() == profile)
150 manager->SelectInTree(node);
151 }
152
153 void BookmarkManager::Show(Profile* profile) {
154 BookmarkManagerView::Show(profile);
155 }
156
157 // -----------------------------------------------------------------------------
158
146 BookmarkManagerView::BookmarkManagerView(Profile* profile) 159 BookmarkManagerView::BookmarkManagerView(Profile* profile)
147 : profile_(profile->GetOriginalProfile()), 160 : profile_(profile->GetOriginalProfile()),
148 table_view_(NULL), 161 table_view_(NULL),
149 tree_view_(NULL), 162 tree_view_(NULL),
150 ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) { 163 ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) {
151 search_tf_ = new views::Textfield(); 164 search_tf_ = new views::Textfield();
152 search_tf_->set_default_width_in_chars(30); 165 search_tf_->set_default_width_in_chars(30);
153 166
154 table_view_ = new BookmarkTableView(profile_, NULL); 167 table_view_ = new BookmarkTableView(profile_, NULL);
155 table_view_->SetObserver(this); 168 table_view_->SetObserver(this);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // The models are deleted before the views. Make sure we set the models of 238 // The models are deleted before the views. Make sure we set the models of
226 // the views to NULL so that they aren't left holding a reference to a 239 // the views to NULL so that they aren't left holding a reference to a
227 // deleted model. 240 // deleted model.
228 table_view_->SetModel(NULL); 241 table_view_->SetModel(NULL);
229 tree_view_->SetModel(NULL); 242 tree_view_->SetModel(NULL);
230 } 243 }
231 manager = NULL; 244 manager = NULL;
232 open_window = NULL; 245 open_window = NULL;
233 } 246 }
234 247
235 // static
236 void BookmarkManagerView::RegisterPrefs(PrefService* prefs) {
237 prefs->RegisterDictionaryPref(prefs::kBookmarkManagerPlacement);
238 prefs->RegisterIntegerPref(prefs::kBookmarkManagerSplitLocation, -1);
239 }
240 248
241 // static 249 // static
242 void BookmarkManagerView::Show(Profile* profile) { 250 void BookmarkManagerView::Show(Profile* profile) {
243 if (!profile->GetBookmarkModel()) 251 if (!profile->GetBookmarkModel())
244 return; 252 return;
245 253
246 if (open_window != NULL) { 254 if (open_window != NULL) {
247 open_window->Activate(); 255 open_window->Activate();
248 return; 256 return;
249 } 257 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 file_type_info.extensions.resize(1); 779 file_type_info.extensions.resize(1);
772 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); 780 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html"));
773 file_type_info.include_all_files = true; 781 file_type_info.include_all_files = true;
774 select_file_dialog_ = SelectFileDialog::Create(this); 782 select_file_dialog_ = SelectFileDialog::Create(this);
775 select_file_dialog_->SelectFile( 783 select_file_dialog_->SelectFile(
776 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), 784 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(),
777 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, 785 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0,
778 L"html", GetWidget()->GetNativeView(), 786 L"html", GetWidget()->GetNativeView(),
779 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); 787 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU));
780 } 788 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_manager_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698