OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 LocationBarViewMac::~LocationBarViewMac() { | 140 LocationBarViewMac::~LocationBarViewMac() { |
141 // Disconnect from cell in case it outlives us. | 141 // Disconnect from cell in case it outlives us. |
142 [[field_ cell] clearDecorations]; | 142 [[field_ cell] clearDecorations]; |
143 } | 143 } |
144 | 144 |
145 void LocationBarViewMac::ShowFirstRunBubble() { | 145 void LocationBarViewMac::ShowFirstRunBubble() { |
146 // We need the browser window to be shown before we can show the bubble, but | 146 // We need the browser window to be shown before we can show the bubble, but |
147 // we get called before that's happened. | 147 // we get called before that's happened. |
148 MessageLoop::current()->PostTask(FROM_HERE, | 148 base::MessageLoop::current()->PostTask(FROM_HERE, |
149 base::Bind(&LocationBarViewMac::ShowFirstRunBubbleInternal, | 149 base::Bind(&LocationBarViewMac::ShowFirstRunBubbleInternal, |
150 weak_ptr_factory_.GetWeakPtr())); | 150 weak_ptr_factory_.GetWeakPtr())); |
151 } | 151 } |
152 | 152 |
153 void LocationBarViewMac::ShowFirstRunBubbleInternal() { | 153 void LocationBarViewMac::ShowFirstRunBubbleInternal() { |
154 if (!field_ || ![field_ window]) | 154 if (!field_ || ![field_ window]) |
155 return; | 155 return; |
156 | 156 |
157 // The first run bubble's left edge should line up with the left edge of the | 157 // The first run bubble's left edge should line up with the left edge of the |
158 // omnibox. This is different from other bubbles, which line up at a point | 158 // omnibox. This is different from other bubbles, which line up at a point |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 if (!toolbar_model_->GetInputInProgress() && | 801 if (!toolbar_model_->GetInputInProgress() && |
802 toolbar_model_->GetSearchTermsType() != ToolbarModel::NO_SEARCH_TERMS) { | 802 toolbar_model_->GetSearchTermsType() != ToolbarModel::NO_SEARCH_TERMS) { |
803 const TemplateURL* template_url = | 803 const TemplateURL* template_url = |
804 TemplateURLServiceFactory::GetForProfile(profile_)-> | 804 TemplateURLServiceFactory::GetForProfile(profile_)-> |
805 GetDefaultSearchProvider(); | 805 GetDefaultSearchProvider(); |
806 if (template_url) | 806 if (template_url) |
807 return template_url->short_name(); | 807 return template_url->short_name(); |
808 } | 808 } |
809 return string16(); | 809 return string16(); |
810 } | 810 } |
OLD | NEW |