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/frame/browser_frame.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 // Only show context menu if point is in unobscured parts of browser, i.e. | 250 // Only show context menu if point is in unobscured parts of browser, i.e. |
251 // if NonClientHitTest returns : | 251 // if NonClientHitTest returns : |
252 // - HTCAPTION: in title bar or unobscured part of tabstrip | 252 // - HTCAPTION: in title bar or unobscured part of tabstrip |
253 // - HTNOWHERE: as the name implies. | 253 // - HTNOWHERE: as the name implies. |
254 gfx::Point point_in_view_coords(p); | 254 gfx::Point point_in_view_coords(p); |
255 views::View::ConvertPointFromScreen(non_client_view(), &point_in_view_coords); | 255 views::View::ConvertPointFromScreen(non_client_view(), &point_in_view_coords); |
256 int hit_test = non_client_view()->NonClientHitTest(point_in_view_coords); | 256 int hit_test = non_client_view()->NonClientHitTest(point_in_view_coords); |
257 if (hit_test == HTCAPTION || hit_test == HTNOWHERE) { | 257 if (hit_test == HTCAPTION || hit_test == HTNOWHERE) { |
258 menu_runner_.reset(new views::MenuRunner(GetSystemMenuModel())); | 258 menu_runner_.reset(new views::MenuRunner(GetSystemMenuModel())); |
259 if (menu_runner_->RunMenuAt(source->GetWidget(), NULL, | 259 if (menu_runner_->RunMenuAt(source->GetWidget(), |
260 gfx::Rect(p, gfx::Size(0,0)), views::MenuItemView::TOPLEFT, | 260 NULL, |
261 source_type, | 261 gfx::Rect(p, gfx::Size(0, 0)), |
262 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == | 262 views::MENU_ANCHOR_TOPLEFT, |
263 views::MenuRunner::MENU_DELETED) | 263 source_type, |
| 264 views::MenuRunner::HAS_MNEMONICS | |
| 265 views::MenuRunner::CONTEXT_MENU) == |
| 266 views::MenuRunner::MENU_DELETED) { |
264 return; | 267 return; |
| 268 } |
265 } | 269 } |
266 } | 270 } |
267 | 271 |
268 ui::MenuModel* BrowserFrame::GetSystemMenuModel() { | 272 ui::MenuModel* BrowserFrame::GetSystemMenuModel() { |
269 #if defined(OS_CHROMEOS) | 273 #if defined(OS_CHROMEOS) |
270 ash::SessionStateDelegate* delegate = | 274 ash::SessionStateDelegate* delegate = |
271 ash::Shell::GetInstance()->session_state_delegate(); | 275 ash::Shell::GetInstance()->session_state_delegate(); |
272 if (delegate && delegate->NumberOfLoggedInUsers() > 1) { | 276 if (delegate && delegate->NumberOfLoggedInUsers() > 1) { |
273 // In Multi user mode, the number of users as well as the order of users | 277 // In Multi user mode, the number of users as well as the order of users |
274 // can change. Coming here we have more then one user and since the menu | 278 // can change. Coming here we have more then one user and since the menu |
(...skipping 21 matching lines...) Expand all Loading... |
296 bool BrowserFrame::ShouldLeaveOffsetNearTopBorder() { | 300 bool BrowserFrame::ShouldLeaveOffsetNearTopBorder() { |
297 return !IsMaximized(); | 301 return !IsMaximized(); |
298 } | 302 } |
299 | 303 |
300 void BrowserFrame::OnUseCustomChromeFrameChanged() { | 304 void BrowserFrame::OnUseCustomChromeFrameChanged() { |
301 // Tell the window manager to add or remove system borders. | 305 // Tell the window manager to add or remove system borders. |
302 set_frame_type(UseCustomFrame() ? Widget::FRAME_TYPE_FORCE_CUSTOM | 306 set_frame_type(UseCustomFrame() ? Widget::FRAME_TYPE_FORCE_CUSTOM |
303 : Widget::FRAME_TYPE_FORCE_NATIVE); | 307 : Widget::FRAME_TYPE_FORCE_NATIVE); |
304 FrameTypeChanged(); | 308 FrameTypeChanged(); |
305 } | 309 } |
OLD | NEW |