| 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/bookmarks/bookmark_context_menu.h" | 5 #include "chrome/browser/bookmarks/bookmark_context_menu.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_editor.h" | 9 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // EditFolderController deletes itself when the window is closed. | 49 // EditFolderController deletes itself when the window is closed. |
| 50 class EditFolderController : public InputWindowDialog::Delegate, | 50 class EditFolderController : public InputWindowDialog::Delegate, |
| 51 public BookmarkModelObserver { | 51 public BookmarkModelObserver { |
| 52 public: | 52 public: |
| 53 virtual ~EditFolderController() { | 53 virtual ~EditFolderController() { |
| 54 if (model_) | 54 if (model_) |
| 55 model_->RemoveObserver(this); | 55 model_->RemoveObserver(this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 static void Show(Profile* profile, | 58 static void Show(Profile* profile, |
| 59 gfx::NativeWindow wnd, | 59 gfx::NativeView wnd, |
| 60 BookmarkNode* node, | 60 BookmarkNode* node, |
| 61 bool is_new, | 61 bool is_new, |
| 62 bool show_in_manager) { | 62 bool show_in_manager) { |
| 63 // EditFolderController deletes itself when done. | 63 // EditFolderController deletes itself when done. |
| 64 EditFolderController* controller = | 64 EditFolderController* controller = |
| 65 new EditFolderController(profile, wnd, node, is_new, show_in_manager); | 65 new EditFolderController(profile, wnd, node, is_new, show_in_manager); |
| 66 controller->Show(); | 66 controller->Show(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 EditFolderController(Profile* profile, | 70 EditFolderController(Profile* profile, |
| 71 gfx::NativeWindow wnd, | 71 gfx::NativeView wnd, |
| 72 BookmarkNode* node, | 72 BookmarkNode* node, |
| 73 bool is_new, | 73 bool is_new, |
| 74 bool show_in_manager) | 74 bool show_in_manager) |
| 75 : profile_(profile), | 75 : profile_(profile), |
| 76 model_(profile->GetBookmarkModel()), | 76 model_(profile->GetBookmarkModel()), |
| 77 node_(node), | 77 node_(node), |
| 78 is_new_(is_new), | 78 is_new_(is_new), |
| 79 show_in_manager_(show_in_manager) { | 79 show_in_manager_(show_in_manager) { |
| 80 DCHECK(is_new_ || node); | 80 DCHECK(is_new_ || node); |
| 81 | 81 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 DISALLOW_COPY_AND_ASSIGN(SelectOnCreationHandler); | 208 DISALLOW_COPY_AND_ASSIGN(SelectOnCreationHandler); |
| 209 }; | 209 }; |
| 210 #endif // #if defined(OS_WIN) | 210 #endif // #if defined(OS_WIN) |
| 211 | 211 |
| 212 } // namespace | 212 } // namespace |
| 213 | 213 |
| 214 // BookmarkContextMenu ------------------------------------------- | 214 // BookmarkContextMenu ------------------------------------------- |
| 215 | 215 |
| 216 BookmarkContextMenu::BookmarkContextMenu( | 216 BookmarkContextMenu::BookmarkContextMenu( |
| 217 gfx::NativeWindow wnd, | 217 gfx::NativeView wnd, |
| 218 Profile* profile, | 218 Profile* profile, |
| 219 Browser* browser, | 219 Browser* browser, |
| 220 PageNavigator* navigator, | 220 PageNavigator* navigator, |
| 221 BookmarkNode* parent, | 221 BookmarkNode* parent, |
| 222 const std::vector<BookmarkNode*>& selection, | 222 const std::vector<BookmarkNode*>& selection, |
| 223 ConfigurationType configuration) | 223 ConfigurationType configuration) |
| 224 : wnd_(wnd), | 224 : wnd_(wnd), |
| 225 profile_(profile), | 225 profile_(profile), |
| 226 browser_(browser), | 226 browser_(browser), |
| 227 navigator_(navigator), | 227 navigator_(navigator), |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 if (NodeHasURLs(selection_[i])) | 551 if (NodeHasURLs(selection_[i])) |
| 552 return true; | 552 return true; |
| 553 } | 553 } |
| 554 return false; | 554 return false; |
| 555 } | 555 } |
| 556 | 556 |
| 557 BookmarkNode* BookmarkContextMenu::GetParentForNewNodes() const { | 557 BookmarkNode* BookmarkContextMenu::GetParentForNewNodes() const { |
| 558 return (selection_.size() == 1 && selection_[0]->is_folder()) ? | 558 return (selection_.size() == 1 && selection_[0]->is_folder()) ? |
| 559 selection_[0] : parent_; | 559 selection_[0] : parent_; |
| 560 } | 560 } |
| OLD | NEW |