#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
+#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/tab_helper.h"
[self setLeftIndentForControls:[[self class] defaultLeftIndentForControls]];
[self setRightIndentForControls:0];
+ // Add this invisible view first so that it is ordered below other views.
+ dragBlockingView_.reset(
+ [[TabStripControllerDragBlockingView alloc] initWithFrame:NSZeroRect
+ controller:self]);
+ [self addSubviewToPermanentList:dragBlockingView_];
+
newTabButton_ = [view getNewTabButton];
[self addSubviewToPermanentList:newTabButton_];
[newTabButton_ setTarget:self];
[newTabButton_ addTrackingArea:newTabTrackingArea_.get()];
targetFrames_.reset([[NSMutableDictionary alloc] init]);
- dragBlockingView_.reset(
- [[TabStripControllerDragBlockingView alloc] initWithFrame:NSZeroRect
- controller:self]);
- [self addSubviewToPermanentList:dragBlockingView_];
-
newTabTargetFrame_ = NSZeroRect;
availableResizeWidth_ = kUseFullAvailableWidth;
tabStripModel_->ExtendSelectionTo(index);
} else if (modifiers & NSCommandKeyMask) {
tabStripModel_->ToggleSelectionAt(index);
- } else if (!tabStripModel_->IsTabSelected(index)) {
+ } else {
tabStripModel_->ActivateTabAt(index, true);
}
}
atIndex:(NSInteger)modelIndex
reason:(int)reason {
// Take closing tabs into account.
- NSInteger activeIndex = [self indexFromModelIndex:modelIndex];
-
if (oldContents) {
int oldModelIndex =
browser_->tab_strip_model()->GetIndexOfWebContents(oldContents);
}
}
- // First get the vector of indices, which is allays sorted in ascending order.
- ui::ListSelectionModel::SelectedIndices selection(
- tabStripModel_->selection_model().selected_indices());
- // Iterate through all of the tabs, selecting each as necessary.
- ui::ListSelectionModel::SelectedIndices::iterator iter = selection.begin();
- int i = 0;
- for (TabController* current in tabArray_.get()) {
- BOOL selected = iter != selection.end() &&
- [self indexFromModelIndex:*iter] == i;
- [current setSelected:selected];
- [current setActive:i == activeIndex];
- if (selected)
- ++iter;
- ++i;
- }
+ NSUInteger activeIndex = [self indexFromModelIndex:modelIndex];
+
+ [tabArray_ enumerateObjectsUsingBlock:^(TabController* current,
+ NSUInteger index,
+ BOOL* stop) {
+ [current setActive:index == activeIndex];
+ }];
// Tell the new tab contents it is about to become the selected tab. Here it
// can do things like make sure the toolbar is up to date.
}
}
+- (void)tabSelectionChanged {
+ // First get the vector of indices, which is allays sorted in ascending order.
+ ui::ListSelectionModel::SelectedIndices selection(
+ tabStripModel_->selection_model().selected_indices());
+ // Iterate through all of the tabs, selecting each as necessary.
+ ui::ListSelectionModel::SelectedIndices::iterator iter = selection.begin();
+ int i = 0;
+ for (TabController* current in tabArray_.get()) {
+ BOOL selected = iter != selection.end() &&
+ [self indexFromModelIndex:*iter] == i;
+ [current setSelected:selected];
+ if (selected)
+ ++iter;
+ ++i;
+ }
+}
+
- (void)tabReplacedWithContents:(content::WebContents*)newContents
previousContents:(content::WebContents*)oldContents
atIndex:(NSInteger)modelIndex {
// If the input is plain text, classify the input and make the URL.
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify(
- base::SysNSStringToUTF16(text), false, false, &match, NULL);
+ base::SysNSStringToUTF16(text), false, false, AutocompleteInput::BLANK,
+ &match, NULL);
GURL url(match.destination_url);
[self openURL:&url inView:view at:point];