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

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

Issue 10854017: Basic metro snap view omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos compilation. 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') | chrome/browser/ui/views/omnibox/omnibox_views.h » ('j') | 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 1fecea8e197831826fa79f2b8a9ee6da9e60c26f..b0684dd1d814e080cb69ebe92ef0f409666c6d65 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -437,7 +437,7 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
ToolbarModel* toolbar_model,
LocationBarView* parent_view,
CommandUpdater* command_updater,
- bool popup_window_mode,
+ WindowMode window_mode,
views::View* location_bar,
views::View* popup_parent_view)
: OmniboxView(parent_view->profile(), controller, toolbar_model,
@@ -446,7 +446,7 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
parent_view->font(), this, model(), location_bar,
popup_parent_view)),
parent_view_(parent_view),
- popup_window_mode_(popup_window_mode),
+ window_mode_(window_mode),
force_hidden_(false),
tracking_click_(),
tracking_double_click_(false),
@@ -474,7 +474,7 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
Create(location_bar->GetWidget()->GetNativeView(), 0, 0, 0,
l10n_util::GetExtendedStyles());
- SetReadOnly(popup_window_mode_);
+ SetReadOnly(window_mode != NORMAL);
SetFont(font_.GetNativeFont());
// NOTE: Do not use SetWordBreakProcEx() here, that is no longer supported as
@@ -482,6 +482,9 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0,
reinterpret_cast<LPARAM>(&WordBreakProc));
+ if (window_mode == DISABLED)
+ EnableWindow(FALSE);
+
// Get the metrics for the font.
base::win::ScopedGetDC screen_dc(NULL);
base::win::ScopedSelectObject font_in_dc(screen_dc, font_.GetNativeFont());
@@ -520,7 +523,7 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
// Register our drop target. RichEdit appears to invoke RevokeDropTarget when
// done so that we don't have to explicitly.
- if (!popup_window_mode_) {
+ if (window_mode == NORMAL) {
scoped_refptr<EditDropTarget> drop_target = new EditDropTarget(this);
RegisterDragDrop(m_hWnd, drop_target.get());
}
@@ -529,8 +532,10 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller,
OmniboxViewWin::~OmniboxViewWin() {
// Explicitly release the text object model now that we're done with it, and
// before we free the library. If the library gets unloaded before this
- // released, it becomes garbage.
- text_object_model_->Release();
+ // released, it becomes garbage. Note that since text_object_model_ is lazy
+ // initialized, it may still be null.
+ if (text_object_model_)
+ text_object_model_->Release();
// We balance our reference count and unpatch when the last instance has
// been destroyed. This prevents us from relying on the AtExit or static
@@ -1443,7 +1448,7 @@ void OmniboxViewWin::OnKeyDown(TCHAR key,
return;
// Make sure that we handle system key events like Alt-F4.
- if (popup_window_mode_) {
+ if (window_mode_ == POPUP) {
DefWindowProc(GetCurrentMessage()->message, key, MAKELPARAM(repeat_count,
flags));
return;
@@ -2581,7 +2586,7 @@ void OmniboxViewWin::BuildContextMenu() {
context_menu_contents_.reset(new ui::SimpleMenuModel(this));
// Set up context menu.
- if (popup_window_mode_) {
+ if (window_mode_ == POPUP) {
context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY);
} else {
context_menu_contents_->AddItemWithStringId(IDS_UNDO, IDS_UNDO);
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | chrome/browser/ui/views/omnibox/omnibox_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698