| OLD | NEW |
| 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/cocoa/omnibox/omnibox_popup_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 const AutocompleteResult& OmniboxPopupViewMac::GetResult() const { | 190 const AutocompleteResult& OmniboxPopupViewMac::GetResult() const { |
| 191 return model_->result(); | 191 return model_->result(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void OmniboxPopupViewMac::CreatePopupIfNeeded() { | 194 void OmniboxPopupViewMac::CreatePopupIfNeeded() { |
| 195 if (!popup_) { | 195 if (!popup_) { |
| 196 popup_.reset( | 196 popup_.reset( |
| 197 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater | 197 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater |
| 198 styleMask:NSBorderlessWindowMask | 198 styleMask:NSBorderlessWindowMask |
| 199 backing:NSBackingStoreBuffered | 199 backing:NSBackingStoreBuffered |
| 200 defer:YES]); | 200 defer:NO]); |
| 201 [popup_ setBackgroundColor:[NSColor clearColor]]; | 201 [popup_ setBackgroundColor:[NSColor clearColor]]; |
| 202 [popup_ setOpaque:NO]; | 202 [popup_ setOpaque:NO]; |
| 203 | 203 |
| 204 // Use a flipped view to pin the matrix top the top left. This is needed | 204 // Use a flipped view to pin the matrix top the top left. This is needed |
| 205 // for animated resize. | 205 // for animated resize. |
| 206 base::scoped_nsobject<FlippedView> contentView( | 206 base::scoped_nsobject<FlippedView> contentView( |
| 207 [[FlippedView alloc] initWithFrame:NSZeroRect]); | 207 [[FlippedView alloc] initWithFrame:NSZeroRect]); |
| 208 [popup_ setContentView:contentView]; | 208 [popup_ setContentView:contentView]; |
| 209 | 209 |
| 210 // View to draw a background beneath the matrix. | 210 // View to draw a background beneath the matrix. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 335 } |
| 336 | 336 |
| 337 void OmniboxPopupViewMac::OpenURLForRow(size_t row, | 337 void OmniboxPopupViewMac::OpenURLForRow(size_t row, |
| 338 WindowOpenDisposition disposition) { | 338 WindowOpenDisposition disposition) { |
| 339 size_t start_match = model_->result().ShouldHideTopMatch() ? 1 : 0; | 339 size_t start_match = model_->result().ShouldHideTopMatch() ? 1 : 0; |
| 340 row += start_match; | 340 row += start_match; |
| 341 DCHECK_LT(row, GetResult().size()); | 341 DCHECK_LT(row, GetResult().size()); |
| 342 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), | 342 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), |
| 343 base::string16(), row); | 343 base::string16(), row); |
| 344 } | 344 } |
| OLD | NEW |