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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 11411286: Decouple IsMetroProcess() calls, introducing IsSingleWindowMetroMode(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r170746 Created 8 years 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
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/omnibox/omnibox_view_win.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <locale> 8 #include <locale>
9 #include <string> 9 #include <string>
10 10
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 // than in OnXButtonDown() since in many scenarios OnSetFocus() will be 1735 // than in OnXButtonDown() since in many scenarios OnSetFocus() will be
1736 // reached before OnXButtonDown(), preventing us from detecting this properly 1736 // reached before OnXButtonDown(), preventing us from detecting this properly
1737 // there. Also in those cases, we need to already know in OnSetFocus() that 1737 // there. Also in those cases, we need to already know in OnSetFocus() that
1738 // we should not restore the saved selection. 1738 // we should not restore the saved selection.
1739 if (!model()->has_focus() && 1739 if (!model()->has_focus() &&
1740 ((mouse_message == WM_LBUTTONDOWN || mouse_message == WM_RBUTTONDOWN)) && 1740 ((mouse_message == WM_LBUTTONDOWN || mouse_message == WM_RBUTTONDOWN)) &&
1741 (result == MA_ACTIVATE)) { 1741 (result == MA_ACTIVATE)) {
1742 if (gaining_focus_) { 1742 if (gaining_focus_) {
1743 // On Windows 8 in metro mode, we get two WM_MOUSEACTIVATE messages when 1743 // On Windows 8 in metro mode, we get two WM_MOUSEACTIVATE messages when
1744 // we click on the omnibox with the mouse. 1744 // we click on the omnibox with the mouse.
1745 DCHECK(base::win::IsMetroProcess()); 1745 DCHECK(win8::IsSingleWindowMetroMode());
cpu_(ooo_6.6-7.5) 2012/12/03 20:56:26 not familiar with this change, again consider this
gab 2012/12/04 00:19:06 This was added by ananta in https://codereview.chr
cpu_(ooo_6.6-7.5) 2012/12/04 01:17:39 Like I said, all other things equal you should pre
gab 2012/12/04 18:47:42 Ok, leaving out for now.
gab 2012/12/04 19:04:31 Reconsidered, leaving it in since this file isn't
1746 return result; 1746 return result;
1747 } 1747 }
1748 gaining_focus_.reset(new ScopedFreeze(this, GetTextObjectModel())); 1748 gaining_focus_.reset(new ScopedFreeze(this, GetTextObjectModel()));
1749 // NOTE: Despite |mouse_message| being WM_XBUTTONDOWN here, we're not 1749 // NOTE: Despite |mouse_message| being WM_XBUTTONDOWN here, we're not
1750 // guaranteed to call OnXButtonDown() later! Specifically, if this is the 1750 // guaranteed to call OnXButtonDown() later! Specifically, if this is the
1751 // second click of a double click, we'll reach here but later call 1751 // second click of a double click, we'll reach here but later call
1752 // OnXButtonDblClk(). Make sure |gaining_focus_| gets reset both places, 1752 // OnXButtonDblClk(). Make sure |gaining_focus_| gets reset both places,
1753 // or we'll have visual glitchiness and then DCHECK failures. 1753 // or we'll have visual glitchiness and then DCHECK failures.
1754 1754
1755 // Don't restore saved selection, it will just screw up our interaction 1755 // Don't restore saved selection, it will just screw up our interaction
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2746 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2747 } 2747 }
2748 2748
2749 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2749 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2750 // Use font_.GetStringWidth() instead of 2750 // Use font_.GetStringWidth() instead of
2751 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2751 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2752 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2752 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2753 // PosFromChar(i) might return 0 when i is greater than 1. 2753 // PosFromChar(i) might return 0 when i is greater than 1.
2754 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2754 return font_.GetStringWidth(text) + GetHorizontalMargin();
2755 } 2755 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698