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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 7134035: Make an inserted selected tab selected before calling TabInsertedAt on observers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename selected to active Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 NavigationEntry* entry = contents->controller().GetActiveEntry(); 185 NavigationEntry* entry = contents->controller().GetActiveEntry();
186 if (entry) { 186 if (entry) {
187 if (entry->favicon().is_valid()) 187 if (entry->favicon().is_valid())
188 result->SetString(keys::kFaviconUrlKey, entry->favicon().url().spec()); 188 result->SetString(keys::kFaviconUrlKey, entry->favicon().url().spec());
189 } 189 }
190 } 190 }
191 191
192 return result; 192 return result;
193 } 193 }
194 194
195 DictionaryValue* ExtensionTabUtil::CreateTabValueActive(
196 const TabContents* contents, bool active) {
sky 2011/06/10 14:58:59 each param on its own line.
Yoyo Zhou 2011/06/10 18:04:01 Done here and elsewhere.
197 DictionaryValue* result = ExtensionTabUtil::CreateTabValue(contents);
198 result->SetBoolean(keys::kSelectedKey, active);
199 return result;
200 }
201
195 // if |populate| is true, each window gets a list property |tabs| which contains 202 // if |populate| is true, each window gets a list property |tabs| which contains
196 // fully populated tab objects. 203 // fully populated tab objects.
197 DictionaryValue* ExtensionTabUtil::CreateWindowValue(const Browser* browser, 204 DictionaryValue* ExtensionTabUtil::CreateWindowValue(const Browser* browser,
198 bool populate_tabs) { 205 bool populate_tabs) {
199 DCHECK(browser); 206 DCHECK(browser);
200 DCHECK(browser->window()); 207 DCHECK(browser->window());
201 DictionaryValue* result = new DictionaryValue(); 208 DictionaryValue* result = new DictionaryValue();
202 result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetWindowId(browser)); 209 result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetWindowId(browser));
203 result->SetBoolean(keys::kIncognitoKey, 210 result->SetBoolean(keys::kIncognitoKey,
204 browser->profile()->IsOffTheRecord()); 211 browser->profile()->IsOffTheRecord());
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 if (update_props->HasKey(keys::kHeightKey)) { 620 if (update_props->HasKey(keys::kHeightKey)) {
614 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 621 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
615 keys::kHeightKey, 622 keys::kHeightKey,
616 &bounds_val)); 623 &bounds_val));
617 bounds.set_height(bounds_val); 624 bounds.set_height(bounds_val);
618 set_bounds = true; 625 set_bounds = true;
619 } 626 }
620 if (set_bounds) 627 if (set_bounds)
621 browser->window()->SetBounds(bounds); 628 browser->window()->SetBounds(bounds);
622 629
623 bool selected_val = false; 630 bool active_val = false;
624 if (update_props->HasKey(keys::kFocusedKey)) { 631 if (update_props->HasKey(keys::kFocusedKey)) {
625 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( 632 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean(
626 keys::kFocusedKey, &selected_val)); 633 keys::kFocusedKey, &active_val));
627 if (selected_val) 634 if (active_val)
628 browser->window()->Activate(); 635 browser->window()->Activate();
629 else 636 else
630 browser->window()->Deactivate(); 637 browser->window()->Deactivate();
631 } 638 }
632 639
633 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); 640 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false));
634 641
635 return true; 642 return true;
636 } 643 }
637 644
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 // called for every API call the extension made. 1350 // called for every API call the extension made.
1344 GotLanguage(language); 1351 GotLanguage(language);
1345 } 1352 }
1346 1353
1347 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1354 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1348 result_.reset(Value::CreateStringValue(language.c_str())); 1355 result_.reset(Value::CreateStringValue(language.c_str()));
1349 SendResponse(true); 1356 SendResponse(true);
1350 1357
1351 Release(); // Balanced in Run() 1358 Release(); // Balanced in Run()
1352 } 1359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698