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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 10879030: hoge (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index 6f1df80bf99502befc5c05b66046ac710ce06a4a..51f93932f8cbdb1181e0ce56f287b52eebf2aa82 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -19,6 +19,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/iat_patch_function.h"
+#include "base/win/metro.h"
#include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h"
#include "base/win/windows_version.h"
@@ -66,7 +67,6 @@
#include "ui/views/widget/widget.h"
#pragma comment(lib, "oleacc.lib") // Needed for accessibility support.
-#pragma comment(lib, "riched20.lib") // Needed for the richedit control.
using content::UserMetricsAction;
using content::WebContents;
@@ -118,6 +118,15 @@ bool IsDrag(const POINT& origin, const POINT& current) {
current.y - origin.y);
}
+const wchar_t* GetRichEditDLLName() {
+ // msftedit.dll is RichEdit ver 4.1.
+ // This version is available from WinXP SP1 and has TSF support.
+ // To minimize the compatibility risk, ver 4.1 is only used
+ // when TSF-aware is required.
+ // At this moment (2012-08-09), only Windows 8 style UI requires it.
+ return base::win::IsTsfAwareRequired() ? L"msftedit.dll": L"riched20.dll";
+}
+
} // namespace
// EditDropTarget is the IDropTarget implementation installed on
@@ -405,9 +414,10 @@ void PaintPatcher::RefPatch() {
if (refcount_ == 0) {
DCHECK(!begin_paint_.is_patched());
DCHECK(!end_paint_.is_patched());
- begin_paint_.Patch(L"riched20.dll", "user32.dll", "BeginPaint",
+ const wchar_t* rich_edit_dll_name = GetRichEditDLLName();
+ begin_paint_.Patch(rich_edit_dll_name, "user32.dll", "BeginPaint",
&BeginPaintIntercept);
- end_paint_.Patch(L"riched20.dll", "user32.dll", "EndPaint",
+ end_paint_.Patch(rich_edit_dll_name, "user32.dll", "EndPaint",
&EndPaintIntercept);
}
++refcount_;
@@ -431,6 +441,8 @@ const int kTwipsPerInch = 1440;
} // namespace
+bool OmniboxViewWin::did_load_library_ = false;
+
OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
ToolbarModel* toolbar_model,
LocationBarView* parent_view,
@@ -462,9 +474,9 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
ToolbarModel::NONE, LocationBarView::BACKGROUND))),
security_level_(ToolbarModel::NONE),
text_object_model_(NULL) {
- // Dummy call to a function exported by riched20.dll to ensure it sets up an
- // import dependency on the dll.
- CreateTextServices(NULL, NULL, NULL);
+ if (!did_load_library_) {
+ did_load_library_ = !!LoadLibrary(GetRichEditDLLName());
+ }
saved_selection_for_focus_change_.cpMin = -1;
@@ -538,6 +550,16 @@ OmniboxViewWin::~OmniboxViewWin() {
g_paint_patcher.Pointer()->DerefPatch();
}
+CWndClassInfo& OmniboxViewWin::GetWndClassInfo() {
+ const wchar_t* kRichEditClass = base::win::IsTsfAwareRequired() ?
+ MSFTEDIT_CLASS : RICHEDIT_CLASS;
+ static CWndClassInfo wc = {
+ {sizeof(WNDCLASSEX), 0, StartWindowProc,
+ 0, 0, NULL, NULL, NULL, NULL, NULL, L"Chrome_OmniboxView", NULL},
+ kRichEditClass, NULL, NULL, TRUE, 0, _T("")};
+ return wc;
+}
+
views::View* OmniboxViewWin::parent_view() const {
return parent_view_;
}
@@ -1339,6 +1361,15 @@ void OmniboxViewWin::OnCopy() {
scw.WriteBookmark(text, url.spec());
}
+LRESULT OmniboxViewWin::OnCreate(const CREATESTRUCTW* /*create_struct*/) {
+ if (base::win::IsTsfAwareRequired()) {
+ // Enable TSF support of RichEdit.
+ SetEditStyle(SES_USECTF, SES_USECTF);
+ }
+ SetMsgHandled(FALSE);
+ return 0;
+}
+
void OmniboxViewWin::OnCut() {
OnCopy();
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698