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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 10084020: Removing defunct code around PureViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge tests. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 8f27c6a58e38b9f18137f4567390020e590f534f..e018a3dbba28f824f8121c59668eb8d4981c79e1 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -79,7 +79,6 @@ WebContents* GetWebContentsFromDelegate(LocationBarView::Delegate* delegate) {
// A utility function to cast OmniboxView to OmniboxViewViews.
OmniboxViewViews* AsViews(OmniboxView* view) {
- DCHECK(views::Widget::IsPureViews());
return static_cast<OmniboxViewViews*>(view);
}
@@ -462,11 +461,10 @@ void LocationBarView::SetInstantSuggestion(const string16& text,
if (!suggested_text_view_) {
suggested_text_view_ = new SuggestedTextView(location_entry_->model());
suggested_text_view_->SetText(text);
- if (views::Widget::IsPureViews())
- NOTIMPLEMENTED();
-#if !defined(USE_AURA)
- else
- suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont());
+#if defined(USE_AURA)
+ NOTIMPLEMENTED();
+#else
+ suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont());
#endif
AddChildView(suggested_text_view_);
} else if (suggested_text_view_->text() != text) {
@@ -491,16 +489,19 @@ string16 LocationBarView::GetInstantSuggestion() const {
#endif
void LocationBarView::SetLocationEntryFocusable(bool focusable) {
- if (views::Widget::IsPureViews())
+#if defined(USE_AURA)
AsViews(location_entry_.get())->SetLocationEntryFocusable(focusable);
- else
+#else
set_focusable(focusable);
+#endif
}
bool LocationBarView::IsLocationEntryFocusableInRootView() const {
- return views::Widget::IsPureViews() ?
- AsViews(location_entry_.get())->IsLocationEntryFocusableInRootView() :
- views::View::IsFocusable();
+#if defined(USE_AURA)
+ return AsViews(location_entry_.get())->IsLocationEntryFocusableInRootView();
+#else
+ return views::View::IsFocusable();
+#endif
}
gfx::Size LocationBarView::GetPreferredSize() {
@@ -722,30 +723,28 @@ void LocationBarView::Layout() {
// keyword hints and suggested text is minimal and we're not confident this
// is the right approach for suggested text.
if (suggested_text_view_) {
- if (views::Widget::IsPureViews()) {
- NOTIMPLEMENTED();
+#if defined(USE_AURA)
+ NOTIMPLEMENTED();
+#else
+ // TODO(sky): need to layout when the user changes caret position.
+ int suggested_text_width =
+ suggested_text_view_->GetPreferredSize().width();
+ int vis_text_width = GetOmniboxViewWin()->WidthOfTextAfterCursor();
+ if (vis_text_width + suggested_text_width > entry_width) {
+ // Hide the suggested text if the user has scrolled or we can't fit all
+ // the suggested text.
+ suggested_text_view_->SetBounds(0, 0, 0, 0);
} else {
-#if !defined(USE_AURA)
- // TODO(sky): need to layout when the user changes caret position.
- int suggested_text_width =
- suggested_text_view_->GetPreferredSize().width();
- int vis_text_width = GetOmniboxViewWin()->WidthOfTextAfterCursor();
- if (vis_text_width + suggested_text_width > entry_width) {
- // Hide the suggested text if the user has scrolled or we can't fit all
- // the suggested text.
- suggested_text_view_->SetBounds(0, 0, 0, 0);
- } else {
- int location_needed_width = location_entry_->TextWidth();
- location_bounds.set_width(std::min(location_needed_width,
- entry_width - suggested_text_width));
- // TODO(sky): figure out why this needs the -1.
- suggested_text_view_->SetBounds(location_bounds.right() - 1,
- location_bounds.y(),
- suggested_text_width,
- location_bounds.height());
- }
-#endif
+ int location_needed_width = location_entry_->TextWidth();
+ location_bounds.set_width(std::min(location_needed_width,
+ entry_width - suggested_text_width));
+ // TODO(sky): figure out why this needs the -1.
+ suggested_text_view_->SetBounds(location_bounds.right() - 1,
+ location_bounds.y(),
+ suggested_text_width,
+ location_bounds.height());
}
+#endif
}
#endif
@@ -856,10 +855,7 @@ void LocationBarView::OnMouseReleased(const views::MouseEvent& event) {
}
void LocationBarView::OnMouseCaptureLost() {
- if (views::Widget::IsPureViews())
- NOTIMPLEMENTED();
- else
- GetOmniboxViewWin()->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint());
+ GetOmniboxViewWin()->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint());
}
#endif
@@ -1058,10 +1054,7 @@ void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) {
UINT flags = event.native_event().wParam;
gfx::Point screen_point(event.location());
ConvertPointToScreen(this, &screen_point);
- if (views::Widget::IsPureViews())
- NOTIMPLEMENTED();
- else
- GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT());
+ GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT());
}
#endif
@@ -1096,13 +1089,14 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(
return true;
}
-#if !defined(USE_AURA)
- if (!views::Widget::IsPureViews())
- return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event);
-#endif
+#if defined(USE_AURA)
NOTIMPLEMENTED();
return false;
#else
+ return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event);
+#endif
+
+#else
// This method is not used for Linux ports. See FocusManager::OnKeyEvent() in
// src/ui/views/focus/focus_manager.cc for details.
return false;
@@ -1300,7 +1294,6 @@ bool LocationBarView::HasValidSuggestText() const {
#if !defined(USE_AURA)
OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
- CHECK(!views::Widget::IsPureViews());
return static_cast<OmniboxViewWin*>(location_entry_.get());
}
#endif
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698