OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_folder_editor_controller.h" | 5 #include "chrome/browser/bookmarks/bookmark_folder_editor_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "chrome/browser/bookmarks/bookmark_manager.h" | |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
11 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
12 | 11 |
13 BookmarkFolderEditorController::~BookmarkFolderEditorController() { | 12 BookmarkFolderEditorController::~BookmarkFolderEditorController() { |
14 if (model_) | 13 if (model_) |
15 model_->RemoveObserver(this); | 14 model_->RemoveObserver(this); |
16 } | 15 } |
17 | 16 |
18 // static | 17 // static |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 54 |
56 void BookmarkFolderEditorController::Show() { | 55 void BookmarkFolderEditorController::Show() { |
57 dialog_->Show(); | 56 dialog_->Show(); |
58 } | 57 } |
59 | 58 |
60 bool BookmarkFolderEditorController::IsValid(const std::wstring& text) { | 59 bool BookmarkFolderEditorController::IsValid(const std::wstring& text) { |
61 return !text.empty(); | 60 return !text.empty(); |
62 } | 61 } |
63 | 62 |
64 void BookmarkFolderEditorController::InputAccepted(const std::wstring& text) { | 63 void BookmarkFolderEditorController::InputAccepted(const std::wstring& text) { |
65 if (IsNew()) { | 64 if (IsNew()) |
66 #if defined(OS_WIN) | |
67 // TODO(viettrungluu): Implement this the following for the tabbed bookmark | |
68 // manager? | |
69 ALLOW_UNUSED const BookmarkNode* node = | |
70 model_->AddGroup(node_, index_, text); | |
71 if ((details_ & SHOW_IN_MANAGER) != 0) | |
72 BookmarkManager::SelectInTree(profile_, node); | |
73 #else | |
74 model_->AddGroup(node_, index_, text); | 65 model_->AddGroup(node_, index_, text); |
75 #endif | 66 else |
76 } else { | |
77 model_->SetTitle(node_, text); | 67 model_->SetTitle(node_, text); |
78 } | |
79 } | 68 } |
80 | 69 |
81 void BookmarkFolderEditorController::InputCanceled() { | 70 void BookmarkFolderEditorController::InputCanceled() { |
82 } | 71 } |
83 | 72 |
84 void BookmarkFolderEditorController::BookmarkModelChanged() { | 73 void BookmarkFolderEditorController::BookmarkModelChanged() { |
85 dialog_->Close(); | 74 dialog_->Close(); |
86 } | 75 } |
87 | 76 |
88 void BookmarkFolderEditorController::BookmarkModelBeingDeleted( | 77 void BookmarkFolderEditorController::BookmarkModelBeingDeleted( |
89 BookmarkModel* model) { | 78 BookmarkModel* model) { |
90 model_->RemoveObserver(this); | 79 model_->RemoveObserver(this); |
91 model_ = NULL; | 80 model_ = NULL; |
92 BookmarkModelChanged(); | 81 BookmarkModelChanged(); |
93 } | 82 } |
94 | 83 |
95 bool BookmarkFolderEditorController::IsNew() { | 84 bool BookmarkFolderEditorController::IsNew() { |
96 return (details_ & IS_NEW) != 0; | 85 return (details_ & IS_NEW) != 0; |
97 } | 86 } |
OLD | NEW |