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/shell_window_registry.h" | 5 #include "chrome/browser/extensions/shell_window_registry.h" |
6 #include "chrome/browser/profiles/profile_dependency_manager.h" | 6 #include "chrome/browser/profiles/profile_dependency_manager.h" |
7 #include "chrome/browser/ui/extensions/shell_window.h" | 7 #include "chrome/browser/ui/extensions/shell_window.h" |
8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 content::RenderViewHost* render_view_host) const { | 51 content::RenderViewHost* render_view_host) const { |
52 for (ShellWindowSet::const_iterator i = shell_windows_.begin(); | 52 for (ShellWindowSet::const_iterator i = shell_windows_.begin(); |
53 i != shell_windows_.end(); ++i) { | 53 i != shell_windows_.end(); ++i) { |
54 if ((*i)->web_contents()->GetRenderViewHost() == render_view_host) | 54 if ((*i)->web_contents()->GetRenderViewHost() == render_view_host) |
55 return *i; | 55 return *i; |
56 } | 56 } |
57 | 57 |
58 return NULL; | 58 return NULL; |
59 } | 59 } |
60 | 60 |
| 61 ShellWindow* ShellWindowRegistry::GetShellWindowForNativeWindow( |
| 62 gfx::NativeWindow window) const { |
| 63 for (ShellWindowSet::const_iterator i = shell_windows_.begin(); |
| 64 i != shell_windows_.end(); ++i) { |
| 65 if ((*i)->GetNativeWindow() == window) |
| 66 return *i; |
| 67 } |
| 68 |
| 69 return NULL; |
| 70 } |
| 71 |
61 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
62 // Factory boilerplate | 73 // Factory boilerplate |
63 | 74 |
64 // static | 75 // static |
65 ShellWindowRegistry* ShellWindowRegistry::Factory::GetForProfile( | 76 ShellWindowRegistry* ShellWindowRegistry::Factory::GetForProfile( |
66 Profile* profile) { | 77 Profile* profile) { |
67 return static_cast<ShellWindowRegistry*>( | 78 return static_cast<ShellWindowRegistry*>( |
68 GetInstance()->GetServiceForProfile(profile, true)); | 79 GetInstance()->GetServiceForProfile(profile, true)); |
69 } | 80 } |
70 | 81 |
(...skipping 14 matching lines...) Expand all Loading... |
85 return new ShellWindowRegistry(); | 96 return new ShellWindowRegistry(); |
86 } | 97 } |
87 | 98 |
88 bool ShellWindowRegistry::Factory::ServiceIsCreatedWithProfile() { | 99 bool ShellWindowRegistry::Factory::ServiceIsCreatedWithProfile() { |
89 return true; | 100 return true; |
90 } | 101 } |
91 | 102 |
92 bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() { | 103 bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() { |
93 return false; | 104 return false; |
94 } | 105 } |
OLD | NEW |