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/ui/views/extensions/native_app_window_views.h" | 5 #include "chrome/browser/ui/views/extensions/native_app_window_views.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/favicon/favicon_tab_helper.h" | 9 #include "chrome/browser/favicon/favicon_tab_helper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // TODO(erg): Conceptually, these are toplevel windows, but we theoretically | 114 // TODO(erg): Conceptually, these are toplevel windows, but we theoretically |
115 // could plumb context through to here in some cases. | 115 // could plumb context through to here in some cases. |
116 init_params.top_level = true; | 116 init_params.top_level = true; |
117 window_->Init(init_params); | 117 window_->Init(init_params); |
118 gfx::Rect window_bounds = create_params.bounds; | 118 gfx::Rect window_bounds = create_params.bounds; |
119 window_bounds.Inset(-GetFrameInsets()); | 119 window_bounds.Inset(-GetFrameInsets()); |
120 // Center window if no position was specified. | 120 // Center window if no position was specified. |
121 if (create_params.bounds.x() == INT_MIN || | 121 if (create_params.bounds.x() == INT_MIN || |
122 create_params.bounds.y() == INT_MIN) { | 122 create_params.bounds.y() == INT_MIN) { |
123 window_->CenterWindow(window_bounds.size()); | 123 window_->CenterWindow(window_bounds.size()); |
124 } else { | 124 } else if (!window_bounds.IsEmpty()) { |
125 window_->SetBounds(window_bounds); | 125 window_->SetBounds(window_bounds); |
126 } | 126 } |
127 | 127 |
128 // Register accelarators supported by app windows. | 128 // Register accelarators supported by app windows. |
129 // TODO(jeremya/stevenjb): should these be registered for panels too? | 129 // TODO(jeremya/stevenjb): should these be registered for panels too? |
130 views::FocusManager* focus_manager = GetFocusManager(); | 130 views::FocusManager* focus_manager = GetFocusManager(); |
131 const std::map<ui::Accelerator, int>& accelerator_table = | 131 const std::map<ui::Accelerator, int>& accelerator_table = |
132 GetAcceleratorTable(); | 132 GetAcceleratorTable(); |
133 for (std::map<ui::Accelerator, int>::const_iterator iter = | 133 for (std::map<ui::Accelerator, int>::const_iterator iter = |
134 accelerator_table.begin(); | 134 accelerator_table.begin(); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 | 586 |
587 //------------------------------------------------------------------------------ | 587 //------------------------------------------------------------------------------ |
588 // NativeAppWindow::Create | 588 // NativeAppWindow::Create |
589 | 589 |
590 // static | 590 // static |
591 NativeAppWindow* NativeAppWindow::Create( | 591 NativeAppWindow* NativeAppWindow::Create( |
592 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 592 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
593 return new NativeAppWindowViews(shell_window, params); | 593 return new NativeAppWindowViews(shell_window, params); |
594 } | 594 } |
OLD | NEW |