| 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/input_ime/input_ime_api.h" | 5 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 414 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
| 415 extensions::InputImeEventRouterFactory::GetInstance()->RemoveProfile( | 415 extensions::InputImeEventRouterFactory::GetInstance()->RemoveProfile( |
| 416 content::Source<Profile>(source).ptr()); | 416 content::Source<Profile>(source).ptr()); |
| 417 } | 417 } |
| 418 | 418 |
| 419 InputImeAPI::~InputImeAPI() { | 419 InputImeAPI::~InputImeAPI() { |
| 420 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 420 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 421 registrar_.RemoveAll(); | 421 registrar_.RemoveAll(); |
| 422 } | 422 } |
| 423 | 423 |
| 424 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputImeAPI> > | 424 static base::LazyInstance< |
| 425 g_factory = LAZY_INSTANCE_INITIALIZER; | 425 BrowserContextKeyedAPIFactory<InputImeAPI>>::DestructorAtExit g_factory = |
| 426 LAZY_INSTANCE_INITIALIZER; |
| 426 | 427 |
| 427 // static | 428 // static |
| 428 BrowserContextKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { | 429 BrowserContextKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { |
| 429 return g_factory.Pointer(); | 430 return g_factory.Pointer(); |
| 430 } | 431 } |
| 431 | 432 |
| 432 InputImeEventRouter* GetInputImeEventRouter(Profile* profile) { | 433 InputImeEventRouter* GetInputImeEventRouter(Profile* profile) { |
| 433 if (!profile) | 434 if (!profile) |
| 434 return nullptr; | 435 return nullptr; |
| 435 if (profile->HasOffTheRecordProfile()) | 436 if (profile->HasOffTheRecordProfile()) |
| 436 profile = profile->GetOffTheRecordProfile(); | 437 profile = profile->GetOffTheRecordProfile(); |
| 437 return extensions::InputImeEventRouterFactory::GetInstance()->GetRouter( | 438 return extensions::InputImeEventRouterFactory::GetInstance()->GetRouter( |
| 438 profile); | 439 profile); |
| 439 } | 440 } |
| 440 | 441 |
| 441 } // namespace extensions | 442 } // namespace extensions |
| OLD | NEW |