Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/ui/views/status_icons/status_icon_win.cc

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/status_icons/status_icon_win.h" 5 #include "chrome/browser/ui/views/status_icons/status_icon_win.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (!menu_model_) 57 if (!menu_model_)
58 return; 58 return;
59 59
60 // Set our window as the foreground window, so the context menu closes when 60 // Set our window as the foreground window, so the context menu closes when
61 // we click away from it. 61 // we click away from it.
62 if (!SetForegroundWindow(window_)) 62 if (!SetForegroundWindow(window_))
63 return; 63 return;
64 64
65 menu_runner_.reset(new views::MenuRunner(menu_model_, 65 menu_runner_.reset(new views::MenuRunner(menu_model_,
66 views::MenuRunner::HAS_MNEMONICS)); 66 views::MenuRunner::HAS_MNEMONICS));
67 ignore_result(menu_runner_->RunMenuAt(NULL, 67 menu_runner_->RunMenuAt(NULL, NULL, gfx::Rect(cursor_pos, gfx::Size()),
68 NULL, 68 views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE);
69 gfx::Rect(cursor_pos, gfx::Size()),
70 views::MENU_ANCHOR_TOPLEFT,
71 ui::MENU_SOURCE_MOUSE));
72 } 69 }
73 70
74 void StatusIconWin::HandleBalloonClickEvent() { 71 void StatusIconWin::HandleBalloonClickEvent() {
75 if (HasObservers()) 72 if (HasObservers())
76 DispatchBalloonClickEvent(); 73 DispatchBalloonClickEvent();
77 } 74 }
78 75
79 void StatusIconWin::ResetIcon() { 76 void StatusIconWin::ResetIcon() {
80 NOTIFYICONDATA icon_data; 77 NOTIFYICONDATA icon_data;
81 InitIconData(&icon_data); 78 InitIconData(&icon_data);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 memset(icon_data, 0, sizeof(NOTIFYICONDATA)); 166 memset(icon_data, 0, sizeof(NOTIFYICONDATA));
170 icon_data->cbSize = sizeof(NOTIFYICONDATA); 167 icon_data->cbSize = sizeof(NOTIFYICONDATA);
171 } else { 168 } else {
172 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE); 169 memset(icon_data, 0, NOTIFYICONDATA_V3_SIZE);
173 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE; 170 icon_data->cbSize = NOTIFYICONDATA_V3_SIZE;
174 } 171 }
175 172
176 icon_data->hWnd = window_; 173 icon_data->hWnd = window_;
177 icon_data->uID = icon_id_; 174 icon_data->uID = icon_id_;
178 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698