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/ui/webui/bookmark_all_tabs_dialog.h" | 5 #include "chrome/browser/ui/webui/bookmark_all_tabs_dialog.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
25 // BookmarkAllTabsDialogBuilder class | 25 // BookmarkAllTabsDialogBuilder class |
26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
27 | 27 |
28 class BookmarkAllTabsDialogBuilder : public ExtensionDialogObserver { | 28 class BookmarkAllTabsDialogBuilder : public ExtensionDialogObserver { |
29 public: | 29 public: |
30 explicit BookmarkAllTabsDialogBuilder(Profile* profile); | 30 explicit BookmarkAllTabsDialogBuilder(Profile* profile); |
31 virtual ~BookmarkAllTabsDialogBuilder(); | 31 virtual ~BookmarkAllTabsDialogBuilder(); |
32 | 32 |
33 // ExtensionDialog::Observer implementation. | 33 // ExtensionDialog::Observer implementation. |
34 virtual void ExtensionDialogIsClosing(ExtensionDialog* dialog) OVERRIDE; | 34 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE; |
35 | 35 |
36 void Show(); | 36 void Show(); |
37 | 37 |
38 private: | 38 private: |
39 Profile* profile_; | 39 Profile* profile_; |
40 | 40 |
41 // Host for the extension that implements this dialog. | 41 // Host for the extension that implements this dialog. |
42 scoped_refptr<ExtensionDialog> extension_dialog_; | 42 scoped_refptr<ExtensionDialog> extension_dialog_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(BookmarkAllTabsDialogBuilder); | 44 DISALLOW_COPY_AND_ASSIGN(BookmarkAllTabsDialogBuilder); |
45 }; | 45 }; |
46 | 46 |
47 BookmarkAllTabsDialogBuilder::BookmarkAllTabsDialogBuilder(Profile* profile) | 47 BookmarkAllTabsDialogBuilder::BookmarkAllTabsDialogBuilder(Profile* profile) |
48 : profile_(profile) { | 48 : profile_(profile) { |
49 } | 49 } |
50 | 50 |
51 BookmarkAllTabsDialogBuilder::~BookmarkAllTabsDialogBuilder() { | 51 BookmarkAllTabsDialogBuilder::~BookmarkAllTabsDialogBuilder() { |
52 if (extension_dialog_) | 52 if (extension_dialog_) |
53 extension_dialog_->ObserverDestroyed(); | 53 extension_dialog_->ObserverDestroyed(); |
54 } | 54 } |
55 | 55 |
56 void BookmarkAllTabsDialogBuilder::ExtensionDialogIsClosing( | 56 void BookmarkAllTabsDialogBuilder::ExtensionDialogClosing( |
57 ExtensionDialog* dialog) { | 57 ExtensionDialog* dialog) { |
58 extension_dialog_ = NULL; | 58 extension_dialog_ = NULL; |
59 delete this; | 59 delete this; |
60 } | 60 } |
61 | 61 |
62 void BookmarkAllTabsDialogBuilder::Show() { | 62 void BookmarkAllTabsDialogBuilder::Show() { |
63 // Extension background pages may not supply an owner_window. | 63 // Extension background pages may not supply an owner_window. |
64 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 64 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); |
65 if (!browser) { | 65 if (!browser) { |
66 LOG(ERROR) << "Can't find owning browser"; | 66 LOG(ERROR) << "Can't find owning browser"; |
(...skipping 20 matching lines...) Expand all Loading... |
87 | 87 |
88 namespace browser { | 88 namespace browser { |
89 | 89 |
90 void ShowBookmarkAllTabsDialog(Profile* profile) { | 90 void ShowBookmarkAllTabsDialog(Profile* profile) { |
91 BookmarkAllTabsDialogBuilder *dialog | 91 BookmarkAllTabsDialogBuilder *dialog |
92 = new BookmarkAllTabsDialogBuilder(profile); | 92 = new BookmarkAllTabsDialogBuilder(profile); |
93 dialog->Show(); | 93 dialog->Show(); |
94 } | 94 } |
95 | 95 |
96 } // namespace browser | 96 } // namespace browser |
OLD | NEW |