| OLD | NEW | 
 | (Empty) | 
|   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 |  | 
|   3 // found in the LICENSE file. |  | 
|   4  |  | 
|   5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_FOLDER_EDITOR_CONTROLLER_H_ |  | 
|   6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_FOLDER_EDITOR_CONTROLLER_H_ |  | 
|   7 #pragma once |  | 
|   8  |  | 
|   9 #include "base/basictypes.h" |  | 
|  10 #include "base/compiler_specific.h" |  | 
|  11 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" |  | 
|  12 #include "chrome/browser/ui/input_window_dialog.h" |  | 
|  13 #include "ui/gfx/native_widget_types.h" |  | 
|  14  |  | 
|  15 class Profile; |  | 
|  16  |  | 
|  17 // BookmarkFolderEditorController manages the editing and/or creation of a |  | 
|  18 // folder. If the user presses ok, the name change is committed to the model. |  | 
|  19 // |  | 
|  20 // BookmarkFolderEditorController deletes itself when the window is closed. |  | 
|  21 class BookmarkFolderEditorController : public InputWindowDialog::Delegate, |  | 
|  22                                        public BaseBookmarkModelObserver { |  | 
|  23  public: |  | 
|  24   enum Type { |  | 
|  25     NEW_BOOKMARK,  // Indicates that we are creating a new bookmark. |  | 
|  26     EXISTING_BOOKMARK,  // Indicates that we are renaming an existing bookmark. |  | 
|  27   }; |  | 
|  28  |  | 
|  29   virtual ~BookmarkFolderEditorController(); |  | 
|  30  |  | 
|  31   static void Show(Profile* profile, |  | 
|  32                    gfx::NativeWindow wnd, |  | 
|  33                    const BookmarkNode* node, |  | 
|  34                    int index, |  | 
|  35                    Type type); |  | 
|  36  |  | 
|  37  private: |  | 
|  38   BookmarkFolderEditorController(Profile* profile, |  | 
|  39                                  gfx::NativeWindow wnd, |  | 
|  40                                  const BookmarkNode* node, |  | 
|  41                                  int index, |  | 
|  42                                  Type type); |  | 
|  43  |  | 
|  44   // InputWindowDialog::Delegate: |  | 
|  45   virtual bool IsValid(const string16& text) OVERRIDE; |  | 
|  46   virtual void InputAccepted(const string16& text) OVERRIDE; |  | 
|  47   virtual void InputCanceled() OVERRIDE; |  | 
|  48  |  | 
|  49   // BaseBookmarkModelObserver: |  | 
|  50   virtual void BookmarkModelChanged() OVERRIDE; |  | 
|  51   virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; |  | 
|  52  |  | 
|  53   Profile* profile_; |  | 
|  54  |  | 
|  55   BookmarkModel* model_; |  | 
|  56  |  | 
|  57   // If |is_new_| is true, this is the parent to create the new node under. |  | 
|  58   // Otherwise this is the node to change the title of. |  | 
|  59   const BookmarkNode* node_; |  | 
|  60  |  | 
|  61   // Index to insert the new folder at. |  | 
|  62   int index_; |  | 
|  63  |  | 
|  64   const bool is_new_; |  | 
|  65  |  | 
|  66   InputWindowDialog* dialog_; |  | 
|  67  |  | 
|  68   DISALLOW_COPY_AND_ASSIGN(BookmarkFolderEditorController); |  | 
|  69 }; |  | 
|  70  |  | 
|  71 #endif  // CHROME_BROWSER_BOOKMARKS_BOOKMARK_FOLDER_EDITOR_CONTROLLER_H_ |  | 
| OLD | NEW |