Chromium Code Reviews| Index: chrome/browser/bookmarks/bookmark_input_window_dialog_controller.h |
| diff --git a/chrome/browser/bookmarks/bookmark_input_window_dialog_controller.h b/chrome/browser/bookmarks/bookmark_input_window_dialog_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a9c3ba5f19c05227e28a645780b8629285040f5b |
| --- /dev/null |
| +++ b/chrome/browser/bookmarks/bookmark_input_window_dialog_controller.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_INPUT_WINDOW_DIALOG_CONTROLLER_H_ |
| +#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_INPUT_WINDOW_DIALOG_CONTROLLER_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "chrome/browser/bookmarks/base_bookmark_model_observer.h" |
| +#include "chrome/browser/ui/input_window_dialog.h" |
| +#include "ui/gfx/native_widget_types.h" |
| + |
| +class Profile; |
| + |
| +// BookmarkInputWindowDialogController manages the editing and/or creation of a |
| +// bookmark page or a bookmark folder. If the user presses ok, the name change |
| +// is committed to the model. |
| +// |
| +// BookmarkInputWindowDialogController deletes itself when the window is closed. |
| +class BookmarkInputWindowDialogController : public InputWindowDialog::Delegate, |
| + public BaseBookmarkModelObserver { |
| + public: |
| + enum Type { |
|
flackr
2011/11/02 15:38:18
BookmarkEditor::EditDetails already encapsulates t
mazda
2011/11/07 09:59:23
Deleted this enum.
|
| + NEW_BOOKMARK_PAGE, // Creates a new bookmark page. |
| + NEW_BOOKMARK_FOLDER, // Creates a new bookmark folder. |
| + EXISTING_BOOKMARK_PAGE, // Modifies an existing bookmark page. |
| + EXISTING_BOOKMARK_FOLDER, // Renames an existing bookmark folder. |
| + }; |
| + |
| + virtual ~BookmarkInputWindowDialogController(); |
| + |
| + static void Show(Profile* profile, |
|
flackr
2011/11/02 15:38:18
Avoid exposing a public method which takes argumen
mazda
2011/11/07 09:59:23
I added index to BookmarkEditor::EditaDetails and
|
| + gfx::NativeWindow wnd, |
| + const BookmarkNode* node, |
| + int index, |
| + Type type); |
| + |
| + private: |
| + BookmarkInputWindowDialogController(Profile* profile, |
| + gfx::NativeWindow wnd, |
| + const BookmarkNode* node, |
| + int index, |
| + Type type); |
| + |
| + // InputWindowDialog::Delegate: |
| + virtual bool IsValid(const InputWindowDialog::InputTexts& texts) OVERRIDE; |
| + virtual void InputAccepted( |
| + const InputWindowDialog::InputTexts& texts) OVERRIDE; |
| + virtual void InputCanceled() OVERRIDE; |
| + |
| + // BaseBookmarkModelObserver: |
| + virtual void BookmarkModelChanged() OVERRIDE; |
| + virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; |
| + |
| + Profile* profile_; |
| + |
| + BookmarkModel* model_; |
| + |
| + // If |is_new_| is true, this is the parent to create the new node under. |
| + // Otherwise this is the node to change the title of. |
| + const BookmarkNode* node_; |
| + |
| + // Index to insert the new folder at. |
| + int index_; |
| + |
| + Type type_; |
| + |
| + InputWindowDialog* dialog_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BookmarkInputWindowDialogController); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_INPUT_WINDOW_DIALOG_CONTROLLER_H_ |