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

Side by Side Diff: chrome/views/window.cc

Issue 42013: Slight code change to make some global variables const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/views/widget_win.h ('k') | chrome/worker/webworkerclient_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/window.h" 5 #include "chrome/views/window.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 8
9 #include "base/win_util.h" 9 #include "base/win_util.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // Update the native frame's text. We do this regardless of whether or not 226 // Update the native frame's text. We do this regardless of whether or not
227 // the native frame is being used, since this also updates the taskbar, etc. 227 // the native frame is being used, since this also updates the taskbar, etc.
228 std::wstring window_title = window_delegate_->GetWindowTitle(); 228 std::wstring window_title = window_delegate_->GetWindowTitle();
229 std::wstring localized_text; 229 std::wstring localized_text;
230 if (l10n_util::AdjustStringForLocaleDirection(window_title, &localized_text)) 230 if (l10n_util::AdjustStringForLocaleDirection(window_title, &localized_text))
231 window_title.assign(localized_text); 231 window_title.assign(localized_text);
232 SetWindowText(GetHWND(), window_title.c_str()); 232 SetWindowText(GetHWND(), window_title.c_str());
233 } 233 }
234 234
235 void Window::UpdateWindowIcon() { 235 void Window::UpdateWindowIcon() {
236 // If the non-client view is rendering its own icon, we need to tell it to rep aint. 236 // If the non-client view is rendering its own icon, we need to tell it to
237 // repaint.
237 non_client_view_->SchedulePaint(); 238 non_client_view_->SchedulePaint();
238 239
239 // Update the native frame's icon. We do this regardless of whether or not 240 // Update the native frame's icon. We do this regardless of whether or not
240 // the native frame is being used, since this also updates the taskbar, etc. 241 // the native frame is being used, since this also updates the taskbar, etc.
241 SkBitmap icon = window_delegate_->GetWindowIcon(); 242 SkBitmap icon = window_delegate_->GetWindowIcon();
242 if (!icon.isNull()) { 243 if (!icon.isNull()) {
243 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(icon); 244 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(icon);
244 // We need to make sure to destroy the previous icon, otherwise we'll leak 245 // We need to make sure to destroy the previous icon, otherwise we'll leak
245 // these GDI objects until we crash! 246 // these GDI objects until we crash!
246 HICON old_icon = reinterpret_cast<HICON>( 247 HICON old_icon = reinterpret_cast<HICON>(
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 691 }
691 692
692 void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) { 693 void Window::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
693 // When we're using a native frame, window controls work without us 694 // When we're using a native frame, window controls work without us
694 // interfering. 695 // interfering.
695 if (!non_client_view_->UseNativeFrame()) { 696 if (!non_client_view_->UseNativeFrame()) {
696 switch (ht_component) { 697 switch (ht_component) {
697 case HTCLOSE: 698 case HTCLOSE:
698 case HTMINBUTTON: 699 case HTMINBUTTON:
699 case HTMAXBUTTON: { 700 case HTMAXBUTTON: {
700 // When the mouse is pressed down in these specific non-client areas, we 701 // When the mouse is pressed down in these specific non-client areas,
701 // need to tell the RootView to send the mouse pressed event (which sets 702 // we need to tell the RootView to send the mouse pressed event (which
702 // capture, allowing subsequent WM_LBUTTONUP (note, _not_ WM_NCLBUTTONUP ) 703 // sets capture, allowing subsequent WM_LBUTTONUP (note, _not_
703 // to fire so that the appropriate WM_SYSCOMMAND can be sent by the 704 // WM_NCLBUTTONUP) to fire so that the appropriate WM_SYSCOMMAND can be
704 // applicable button's ButtonListener. We _have_ to do this this way 705 // sent by the applicable button's ButtonListener. We _have_ to do this
705 // rather than letting Windows just send the syscommand itself (as would 706 // way rather than letting Windows just send the syscommand itself (as
706 // happen if we never did this dance) because for some insane reason 707 // would happen if we never did this dance) because for some insane
707 // DefWindowProc for WM_NCLBUTTONDOWN also renders the pressed window 708 // reason DefWindowProc for WM_NCLBUTTONDOWN also renders the pressed
708 // control button appearance, in the Windows classic style, over our 709 // window control button appearance, in the Windows classic style, over
709 // view! Ick! By handling this message we prevent Windows from doing thi s 710 // our view! Ick! By handling this message we prevent Windows from
710 // undesirable thing, but that means we need to roll the sys-command 711 // doing this undesirable thing, but that means we need to roll the
711 // handling ourselves. 712 // sys-command handling ourselves.
712 ProcessNCMousePress(point, MK_LBUTTON); 713 ProcessNCMousePress(point, MK_LBUTTON);
713 return; 714 return;
714 } 715 }
715 } 716 }
716 } 717 }
717 718
718 // TODO(beng): figure out why we need to run the system menu manually 719 // TODO(beng): figure out why we need to run the system menu manually
719 // ourselves. This is wrong and causes many subtle bugs. 720 // ourselves. This is wrong and causes many subtle bugs.
720 // From my initial research, it looks like DefWindowProc tries 721 // From my initial research, it looks like DefWindowProc tries
721 // to run it but fails before sending the initial WM_MENUSELECT 722 // to run it but fails before sending the initial WM_MENUSELECT
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); 1152 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS);
1152 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); 1153 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE);
1153 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); 1154 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW);
1154 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); 1155 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE);
1155 initialized = true; 1156 initialized = true;
1156 } 1157 }
1157 } 1158 }
1158 1159
1159 } // namespace views 1160 } // namespace views
1160 1161
OLDNEW
« no previous file with comments | « chrome/views/widget_win.h ('k') | chrome/worker/webworkerclient_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698