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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return; | 254 return; |
255 | 255 |
256 // Only show context menu if point is in unobscured parts of browser, i.e. | 256 // Only show context menu if point is in unobscured parts of browser, i.e. |
257 // if NonClientHitTest returns : | 257 // if NonClientHitTest returns : |
258 // - HTCAPTION: in title bar or unobscured part of tabstrip | 258 // - HTCAPTION: in title bar or unobscured part of tabstrip |
259 // - HTNOWHERE: as the name implies. | 259 // - HTNOWHERE: as the name implies. |
260 gfx::Point point_in_view_coords(p); | 260 gfx::Point point_in_view_coords(p); |
261 views::View::ConvertPointFromScreen(non_client_view(), &point_in_view_coords); | 261 views::View::ConvertPointFromScreen(non_client_view(), &point_in_view_coords); |
262 int hit_test = non_client_view()->NonClientHitTest(point_in_view_coords); | 262 int hit_test = non_client_view()->NonClientHitTest(point_in_view_coords); |
263 if (hit_test == HTCAPTION || hit_test == HTNOWHERE) { | 263 if (hit_test == HTCAPTION || hit_test == HTNOWHERE) { |
264 menu_runner_.reset(new views::MenuRunner(GetSystemMenuModel())); | 264 menu_runner_.reset(new views::MenuRunner( |
| 265 GetSystemMenuModel(), |
| 266 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU)); |
265 if (menu_runner_->RunMenuAt(source->GetWidget(), | 267 if (menu_runner_->RunMenuAt(source->GetWidget(), |
266 NULL, | 268 NULL, |
267 gfx::Rect(p, gfx::Size(0, 0)), | 269 gfx::Rect(p, gfx::Size(0, 0)), |
268 views::MENU_ANCHOR_TOPLEFT, | 270 views::MENU_ANCHOR_TOPLEFT, |
269 source_type, | 271 source_type) == |
270 views::MenuRunner::HAS_MNEMONICS | | |
271 views::MenuRunner::CONTEXT_MENU) == | |
272 views::MenuRunner::MENU_DELETED) { | 272 views::MenuRunner::MENU_DELETED) { |
273 return; | 273 return; |
274 } | 274 } |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 ui::MenuModel* BrowserFrame::GetSystemMenuModel() { | 278 ui::MenuModel* BrowserFrame::GetSystemMenuModel() { |
279 #if defined(OS_CHROMEOS) | 279 #if defined(OS_CHROMEOS) |
280 ash::SessionStateDelegate* delegate = | 280 ash::SessionStateDelegate* delegate = |
281 ash::Shell::GetInstance()->session_state_delegate(); | 281 ash::Shell::GetInstance()->session_state_delegate(); |
(...skipping 24 matching lines...) Expand all Loading... |
306 bool BrowserFrame::ShouldLeaveOffsetNearTopBorder() { | 306 bool BrowserFrame::ShouldLeaveOffsetNearTopBorder() { |
307 return !IsMaximized(); | 307 return !IsMaximized(); |
308 } | 308 } |
309 | 309 |
310 void BrowserFrame::OnUseCustomChromeFrameChanged() { | 310 void BrowserFrame::OnUseCustomChromeFrameChanged() { |
311 // Tell the window manager to add or remove system borders. | 311 // Tell the window manager to add or remove system borders. |
312 set_frame_type(UseCustomFrame() ? Widget::FRAME_TYPE_FORCE_CUSTOM | 312 set_frame_type(UseCustomFrame() ? Widget::FRAME_TYPE_FORCE_CUSTOM |
313 : Widget::FRAME_TYPE_FORCE_NATIVE); | 313 : Widget::FRAME_TYPE_FORCE_NATIVE); |
314 FrameTypeChanged(); | 314 FrameTypeChanged(); |
315 } | 315 } |
OLD | NEW |