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

Side by Side Diff: chrome/browser/automation/automation_util.cc

Issue 10891044: RestoreTabHelper > SessionTabHelper, move more session stuff into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/automation/automation_util.h" 5 #include "chrome/browser/automation/automation_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/automation/automation_provider.h" 16 #include "chrome/browser/automation/automation_provider.h"
17 #include "chrome/browser/automation/automation_provider_json.h" 17 #include "chrome/browser/automation/automation_provider_json.h"
18 #include "chrome/browser/extensions/extension_process_manager.h" 18 #include "chrome/browser/extensions/extension_process_manager.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/printing/print_preview_tab_controller.h" 20 #include "chrome/browser/printing/print_preview_tab_controller.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/sessions/restore_tab_helper.h"
23 #include "chrome/browser/sessions/session_id.h" 22 #include "chrome/browser/sessions/session_id.h"
23 #include "chrome/browser/sessions/session_tab_helper.h"
24 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 24 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
25 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
27 #include "chrome/browser/ui/browser_tabstrip.h" 27 #include "chrome/browser/ui/browser_tabstrip.h"
28 #include "chrome/browser/ui/tab_contents/tab_contents.h" 28 #include "chrome/browser/ui/tab_contents/tab_contents.h"
29 #include "chrome/browser/view_type_utils.h" 29 #include "chrome/browser/view_type_utils.h"
30 #include "chrome/common/automation_id.h" 30 #include "chrome/common/automation_id.h"
31 #include "chrome/common/extensions/extension.h" 31 #include "chrome/common/extensions/extension.h"
32 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (active) { 404 if (active) {
405 AutomationJSONReply(provider, message).SendErrorCode( 405 AutomationJSONReply(provider, message).SendErrorCode(
406 automation::kBlockedByModalDialog); 406 automation::kBlockedByModalDialog);
407 } 407 }
408 return active; 408 return active;
409 } 409 }
410 410
411 AutomationId GetIdForTab(const TabContents* tab) { 411 AutomationId GetIdForTab(const TabContents* tab) {
412 return AutomationId( 412 return AutomationId(
413 AutomationId::kTypeTab, 413 AutomationId::kTypeTab,
414 base::IntToString(tab->restore_tab_helper()->session_id().id())); 414 base::IntToString(tab->session_tab_helper()->session_id().id()));
415 } 415 }
416 416
417 AutomationId GetIdForExtensionView( 417 AutomationId GetIdForExtensionView(
418 const content::RenderViewHost* render_view_host) { 418 const content::RenderViewHost* render_view_host) {
419 AutomationId::Type type; 419 AutomationId::Type type;
420 WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host); 420 WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host);
421 switch (chrome::GetViewType(web_contents)) { 421 switch (chrome::GetViewType(web_contents)) {
422 case chrome::VIEW_TYPE_EXTENSION_POPUP: 422 case chrome::VIEW_TYPE_EXTENSION_POPUP:
423 type = AutomationId::kTypeExtensionPopup; 423 type = AutomationId::kTypeExtensionPopup;
424 break; 424 break;
(...skipping 27 matching lines...) Expand all
452 return false; 452 return false;
453 453
454 printing::PrintPreviewTabController* preview_controller = 454 printing::PrintPreviewTabController* preview_controller =
455 printing::PrintPreviewTabController::GetInstance(); 455 printing::PrintPreviewTabController::GetInstance();
456 BrowserList::const_iterator iter = BrowserList::begin(); 456 BrowserList::const_iterator iter = BrowserList::begin();
457 for (; iter != BrowserList::end(); ++iter) { 457 for (; iter != BrowserList::end(); ++iter) {
458 Browser* browser = *iter; 458 Browser* browser = *iter;
459 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { 459 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) {
460 TabContents* tab_contents = chrome::GetTabContentsAt(browser, tab_index); 460 TabContents* tab_contents = chrome::GetTabContentsAt(browser, tab_index);
461 if (base::IntToString( 461 if (base::IntToString(
462 tab_contents->restore_tab_helper()->session_id().id()) == 462 tab_contents->session_tab_helper()->session_id().id()) ==
463 id.id()) { 463 id.id()) {
464 *tab = tab_contents->web_contents(); 464 *tab = tab_contents->web_contents();
465 return true; 465 return true;
466 } 466 }
467 if (preview_controller) { 467 if (preview_controller) {
468 TabContents* preview_tab_contents = 468 TabContents* preview_tab_contents =
469 preview_controller->GetPrintPreviewForTab(tab_contents); 469 preview_controller->GetPrintPreviewForTab(tab_contents);
470 if (preview_tab_contents) { 470 if (preview_tab_contents) {
471 std::string preview_id = base::IntToString( 471 std::string preview_id = base::IntToString(
472 preview_tab_contents->restore_tab_helper()->session_id().id()); 472 preview_tab_contents->session_tab_helper()->session_id().id());
473 if (preview_id == id.id()) { 473 if (preview_id == id.id()) {
474 *tab = preview_tab_contents->web_contents(); 474 *tab = preview_tab_contents->web_contents();
475 return true; 475 return true;
476 } 476 }
477 } 477 }
478 } 478 }
479 } 479 }
480 } 480 }
481 return false; 481 return false;
482 } 482 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 const extensions::Extension* extension; 561 const extensions::Extension* extension;
562 return GetExtensionForId(id, profile, &extension); 562 return GetExtensionForId(id, profile, &extension);
563 } 563 }
564 default: 564 default:
565 break; 565 break;
566 } 566 }
567 return false; 567 return false;
568 } 568 }
569 569
570 } // namespace automation_util 570 } // namespace automation_util
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_win.cc ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698