OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/bookmarks/bookmarks_api.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 event_router->RegisterObserver(this, bookmarks::OnImportEnded::kEventName); | 396 event_router->RegisterObserver(this, bookmarks::OnImportEnded::kEventName); |
397 } | 397 } |
398 | 398 |
399 BookmarksAPI::~BookmarksAPI() { | 399 BookmarksAPI::~BookmarksAPI() { |
400 } | 400 } |
401 | 401 |
402 void BookmarksAPI::Shutdown() { | 402 void BookmarksAPI::Shutdown() { |
403 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 403 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
404 } | 404 } |
405 | 405 |
406 static base::LazyInstance<BrowserContextKeyedAPIFactory<BookmarksAPI> > | 406 static base::LazyInstance< |
407 g_factory = LAZY_INSTANCE_INITIALIZER; | 407 BrowserContextKeyedAPIFactory<BookmarksAPI>>::DestructorAtExit g_factory = |
| 408 LAZY_INSTANCE_INITIALIZER; |
408 | 409 |
409 // static | 410 // static |
410 BrowserContextKeyedAPIFactory<BookmarksAPI>* | 411 BrowserContextKeyedAPIFactory<BookmarksAPI>* |
411 BookmarksAPI::GetFactoryInstance() { | 412 BookmarksAPI::GetFactoryInstance() { |
412 return g_factory.Pointer(); | 413 return g_factory.Pointer(); |
413 } | 414 } |
414 | 415 |
415 void BookmarksAPI::OnListenerAdded(const EventListenerInfo& details) { | 416 void BookmarksAPI::OnListenerAdded(const EventListenerInfo& details) { |
416 bookmark_event_router_.reset( | 417 bookmark_event_router_.reset( |
417 new BookmarkEventRouter(Profile::FromBrowserContext(browser_context_))); | 418 new BookmarkEventRouter(Profile::FromBrowserContext(browser_context_))); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 } | 839 } |
839 | 840 |
840 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 841 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
841 int index, | 842 int index, |
842 void* params) { | 843 void* params) { |
843 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 844 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
844 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 845 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
845 } | 846 } |
846 | 847 |
847 } // namespace extensions | 848 } // namespace extensions |
OLD | NEW |