| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 string16 title = is_new_ ? | 44 string16 title = is_new_ ? |
| 45 l10n_util::GetStringUTF16(IDS_BOOKMARK_FOLDER_EDITOR_WINDOW_TITLE_NEW) : | 45 l10n_util::GetStringUTF16(IDS_BOOKMARK_FOLDER_EDITOR_WINDOW_TITLE_NEW) : |
| 46 l10n_util::GetStringUTF16(IDS_BOOKMARK_FOLDER_EDITOR_WINDOW_TITLE); | 46 l10n_util::GetStringUTF16(IDS_BOOKMARK_FOLDER_EDITOR_WINDOW_TITLE); |
| 47 string16 label = | 47 string16 label = |
| 48 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_EDIT_FOLDER_LABEL); | 48 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_EDIT_FOLDER_LABEL); |
| 49 string16 contents = is_new_ ? | 49 string16 contents = is_new_ ? |
| 50 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME) : | 50 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME) : |
| 51 node_->GetTitle(); | 51 node_->GetTitle(); |
| 52 | 52 |
| 53 #if !defined(USE_AURA) | |
| 54 // TODO(saintlou): We seem to be missing a pure Views implemntation. | |
| 55 dialog_ = InputWindowDialog::Create(wnd, title, label, contents, this); | 53 dialog_ = InputWindowDialog::Create(wnd, title, label, contents, this); |
| 56 dialog_->Show(); | 54 dialog_->Show(); |
| 57 #endif | |
| 58 } | 55 } |
| 59 | 56 |
| 60 bool BookmarkFolderEditorController::IsValid(const string16& text) { | 57 bool BookmarkFolderEditorController::IsValid(const string16& text) { |
| 61 return !text.empty(); | 58 return !text.empty(); |
| 62 } | 59 } |
| 63 | 60 |
| 64 void BookmarkFolderEditorController::InputAccepted(const string16& text) { | 61 void BookmarkFolderEditorController::InputAccepted(const string16& text) { |
| 65 if (is_new_) | 62 if (is_new_) |
| 66 model_->AddFolder(node_, index_, text); | 63 model_->AddFolder(node_, index_, text); |
| 67 else | 64 else |
| 68 model_->SetTitle(node_, text); | 65 model_->SetTitle(node_, text); |
| 69 } | 66 } |
| 70 | 67 |
| 71 void BookmarkFolderEditorController::InputCanceled() { | 68 void BookmarkFolderEditorController::InputCanceled() { |
| 72 } | 69 } |
| 73 | 70 |
| 74 void BookmarkFolderEditorController::BookmarkModelChanged() { | 71 void BookmarkFolderEditorController::BookmarkModelChanged() { |
| 75 dialog_->Close(); | 72 dialog_->Close(); |
| 76 } | 73 } |
| 77 | 74 |
| 78 void BookmarkFolderEditorController::BookmarkModelBeingDeleted( | 75 void BookmarkFolderEditorController::BookmarkModelBeingDeleted( |
| 79 BookmarkModel* model) { | 76 BookmarkModel* model) { |
| 80 model_->RemoveObserver(this); | 77 model_->RemoveObserver(this); |
| 81 model_ = NULL; | 78 model_ = NULL; |
| 82 BookmarkModelChanged(); | 79 BookmarkModelChanged(); |
| 83 } | 80 } |
| OLD | NEW |