OLD | NEW |
1 // Copyright (c) 2011 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 #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/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, | 111 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, |
112 profile_->GetPrefs(), this); | 112 profile_->GetPrefs(), this); |
113 } | 113 } |
114 | 114 |
115 LocationBarViewMac::~LocationBarViewMac() { | 115 LocationBarViewMac::~LocationBarViewMac() { |
116 // Disconnect from cell in case it outlives us. | 116 // Disconnect from cell in case it outlives us. |
117 [[field_ cell] clearDecorations]; | 117 [[field_ cell] clearDecorations]; |
118 } | 118 } |
119 | 119 |
120 void LocationBarViewMac::ShowFirstRunBubble(FirstRun::BubbleType bubble_type) { | 120 void LocationBarViewMac::ShowFirstRunBubble() { |
121 // We need the browser window to be shown before we can show the bubble, but | 121 // We need the browser window to be shown before we can show the bubble, but |
122 // we get called before that's happened. | 122 // we get called before that's happened. |
123 MessageLoop::current()->PostTask(FROM_HERE, | 123 MessageLoop::current()->PostTask(FROM_HERE, |
124 base::Bind(&LocationBarViewMac::ShowFirstRunBubbleInternal, | 124 base::Bind(&LocationBarViewMac::ShowFirstRunBubbleInternal, |
125 weak_ptr_factory_.GetWeakPtr(), bubble_type)); | 125 weak_ptr_factory_.GetWeakPtr())); |
126 } | 126 } |
127 | 127 |
128 void LocationBarViewMac::ShowFirstRunBubbleInternal( | 128 void LocationBarViewMac::ShowFirstRunBubbleInternal() { |
129 FirstRun::BubbleType bubble_type) { | |
130 if (!field_ || ![field_ window]) | 129 if (!field_ || ![field_ window]) |
131 return; | 130 return; |
132 | 131 |
133 // The first run bubble's left edge should line up with the left edge of the | 132 // The first run bubble's left edge should line up with the left edge of the |
134 // omnibox. This is different from other bubbles, which line up at a point | 133 // omnibox. This is different from other bubbles, which line up at a point |
135 // set by their top arrow. Because the BaseBubbleController adjusts the | 134 // set by their top arrow. Because the BaseBubbleController adjusts the |
136 // window origin left to account for the arrow spacing, the first run bubble | 135 // window origin left to account for the arrow spacing, the first run bubble |
137 // moves the window origin right by this spacing, so that the | 136 // moves the window origin right by this spacing, so that the |
138 // BaseBubbleController will move it back to the correct position. | 137 // BaseBubbleController will move it back to the correct position. |
139 const NSPoint kOffset = NSMakePoint( | 138 const NSPoint kOffset = NSMakePoint( |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 643 |
645 [field_ setNeedsDisplay:YES]; | 644 [field_ setNeedsDisplay:YES]; |
646 } | 645 } |
647 | 646 |
648 bool LocationBarViewMac::IsStarEnabled() { | 647 bool LocationBarViewMac::IsStarEnabled() { |
649 return [field_ isEditable] && | 648 return [field_ isEditable] && |
650 browser_defaults::bookmarks_enabled && | 649 browser_defaults::bookmarks_enabled && |
651 !toolbar_model_->input_in_progress() && | 650 !toolbar_model_->input_in_progress() && |
652 edit_bookmarks_enabled_.GetValue(); | 651 edit_bookmarks_enabled_.GetValue(); |
653 } | 652 } |
OLD | NEW |