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

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

Issue 480883002: Move session_id.{cc,h} from chrome/browser/sessions to components/sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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) 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/extensions/extension_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include "apps/app_window.h" 7 #include "apps/app_window.h"
8 #include "apps/app_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
11 #include "chrome/browser/extensions/chrome_extension_function.h" 11 #include "chrome/browser/extensions/chrome_extension_function.h"
12 #include "chrome/browser/extensions/tab_helper.h" 12 #include "chrome/browser/extensions/tab_helper.h"
13 #include "chrome/browser/extensions/window_controller.h" 13 #include "chrome/browser/extensions/window_controller.h"
14 #include "chrome/browser/extensions/window_controller_list.h" 14 #include "chrome/browser/extensions/window_controller_list.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sessions/session_id.h" 16 #include "chrome/browser/sessions/session_tab_helper.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/browser_iterator.h" 19 #include "chrome/browser/ui/browser_iterator.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
22 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "chrome/common/extensions/api/tabs.h" 24 #include "chrome/common/extensions/api/tabs.h"
25 #include "chrome/common/extensions/manifest_url_handler.h" 25 #include "chrome/common/extensions/manifest_url_handler.h"
26 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 int ExtensionTabUtil::GetWindowIdOfTabStripModel( 282 int ExtensionTabUtil::GetWindowIdOfTabStripModel(
283 const TabStripModel* tab_strip_model) { 283 const TabStripModel* tab_strip_model) {
284 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 284 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
285 if (it->tab_strip_model() == tab_strip_model) 285 if (it->tab_strip_model() == tab_strip_model)
286 return GetWindowId(*it); 286 return GetWindowId(*it);
287 } 287 }
288 return -1; 288 return -1;
289 } 289 }
290 290
291 int ExtensionTabUtil::GetTabId(const WebContents* web_contents) { 291 int ExtensionTabUtil::GetTabId(const WebContents* web_contents) {
292 return SessionID::IdForTab(web_contents); 292 return SessionTabHelper::IdForTab(web_contents);
293 } 293 }
294 294
295 std::string ExtensionTabUtil::GetTabStatusText(bool is_loading) { 295 std::string ExtensionTabUtil::GetTabStatusText(bool is_loading) {
296 return is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete; 296 return is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete;
297 } 297 }
298 298
299 int ExtensionTabUtil::GetWindowIdOfTab(const WebContents* web_contents) { 299 int ExtensionTabUtil::GetWindowIdOfTab(const WebContents* web_contents) {
300 return SessionID::IdForWindowContainingTab(web_contents); 300 return SessionTabHelper::IdForWindowContainingTab(web_contents);
301 } 301 }
302 302
303 base::DictionaryValue* ExtensionTabUtil::CreateTabValue( 303 base::DictionaryValue* ExtensionTabUtil::CreateTabValue(
304 WebContents* contents, 304 WebContents* contents,
305 TabStripModel* tab_strip, 305 TabStripModel* tab_strip,
306 int tab_index, 306 int tab_index,
307 const Extension* extension) { 307 const Extension* extension) {
308 // If we have a matching AppWindow with a controller, get the tab value 308 // If we have a matching AppWindow with a controller, get the tab value
309 // from its controller instead. 309 // from its controller instead.
310 WindowController* controller = GetAppWindowController(contents); 310 WindowController* controller = GetAppWindowController(contents);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 Profile* incognito_profile = 460 Profile* incognito_profile =
461 include_incognito && profile->HasOffTheRecordProfile() ? 461 include_incognito && profile->HasOffTheRecordProfile() ?
462 profile->GetOffTheRecordProfile() : NULL; 462 profile->GetOffTheRecordProfile() : NULL;
463 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 463 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
464 Browser* target_browser = *it; 464 Browser* target_browser = *it;
465 if (target_browser->profile() == profile || 465 if (target_browser->profile() == profile ||
466 target_browser->profile() == incognito_profile) { 466 target_browser->profile() == incognito_profile) {
467 TabStripModel* target_tab_strip = target_browser->tab_strip_model(); 467 TabStripModel* target_tab_strip = target_browser->tab_strip_model();
468 for (int i = 0; i < target_tab_strip->count(); ++i) { 468 for (int i = 0; i < target_tab_strip->count(); ++i) {
469 WebContents* target_contents = target_tab_strip->GetWebContentsAt(i); 469 WebContents* target_contents = target_tab_strip->GetWebContentsAt(i);
470 if (SessionID::IdForTab(target_contents) == tab_id) { 470 if (SessionTabHelper::IdForTab(target_contents) == tab_id) {
471 if (browser) 471 if (browser)
472 *browser = target_browser; 472 *browser = target_browser;
473 if (tab_strip) 473 if (tab_strip)
474 *tab_strip = target_tab_strip; 474 *tab_strip = target_tab_strip;
475 if (contents) 475 if (contents)
476 *contents = target_contents; 476 *contents = target_contents;
477 if (tab_index) 477 if (tab_index)
478 *tab_index = i; 478 *tab_index = i;
479 return true; 479 return true;
480 } 480 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 content::PAGE_TRANSITION_LINK, 572 content::PAGE_TRANSITION_LINK,
573 false); 573 false);
574 browser->OpenURL(params); 574 browser->OpenURL(params);
575 browser->window()->Show(); 575 browser->window()->Show();
576 WebContents* web_contents = 576 WebContents* web_contents =
577 browser->tab_strip_model()->GetActiveWebContents(); 577 browser->tab_strip_model()->GetActiveWebContents();
578 web_contents->GetDelegate()->ActivateContents(web_contents); 578 web_contents->GetDelegate()->ActivateContents(web_contents);
579 } 579 }
580 580
581 } // namespace extensions 581 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_apitest.cc ('k') | chrome/browser/extensions/page_action_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698