summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_util.cc2
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc12
-rw-r--r--chrome/browser/printing/print_preview_context_menu_observer.cc8
-rw-r--r--chrome/browser/printing/print_preview_context_menu_observer.h6
-rw-r--r--chrome/browser/printing/print_preview_dialog_controller.cc13
-rw-r--r--chrome/browser/printing/print_preview_dialog_controller.h17
-rw-r--r--chrome/browser/printing/print_view_manager.cc23
-rw-r--r--chrome/browser/printing/print_view_manager.h8
-rw-r--r--chrome/browser/ui/browser_commands.cc4
-rw-r--r--chrome/browser/ui/webui/web_ui_browsertest.cc6
10 files changed, 54 insertions, 45 deletions
diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc
index 1b7cd3c..288a9d9 100644
--- a/chrome/browser/automation/automation_util.cc
+++ b/chrome/browser/automation/automation_util.cc
@@ -526,7 +526,7 @@ bool GetTabForId(const AutomationId& id, WebContents** tab) {
}
if (preview_controller) {
WebContents* print_preview_contents =
- preview_controller->GetPrintPreviewForTab(web_contents);
+ preview_controller->GetPrintPreviewForContents(web_contents);
if (print_preview_contents) {
SessionTabHelper* preview_session_tab_helper =
SessionTabHelper::FromWebContents(print_preview_contents);
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 767ff62..2a15219 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -5643,17 +5643,17 @@ void TestingAutomationProvider::GetViews(
for (; browser_iter != BrowserList::end(); ++browser_iter) {
Browser* browser = *browser_iter;
for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
- WebContents* tab = browser->tab_strip_model()->GetWebContentsAt(i);
+ WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i);
DictionaryValue* dict = new DictionaryValue();
- AutomationId id = automation_util::GetIdForTab(tab);
+ AutomationId id = automation_util::GetIdForTab(contents);
dict->Set("auto_id", id.ToValue());
view_list->Append(dict);
if (preview_controller) {
- WebContents* preview_tab =
- preview_controller->GetPrintPreviewForTab(tab);
- if (preview_tab) {
+ WebContents* preview_dialog =
+ preview_controller->GetPrintPreviewForContents(contents);
+ if (preview_dialog) {
DictionaryValue* dict = new DictionaryValue();
- AutomationId id = automation_util::GetIdForTab(preview_tab);
+ AutomationId id = automation_util::GetIdForTab(preview_dialog);
dict->Set("auto_id", id.ToValue());
view_list->Append(dict);
}
diff --git a/chrome/browser/printing/print_preview_context_menu_observer.cc b/chrome/browser/printing/print_preview_context_menu_observer.cc
index 4e0a2a2..b9c2a02 100644
--- a/chrome/browser/printing/print_preview_context_menu_observer.cc
+++ b/chrome/browser/printing/print_preview_context_menu_observer.cc
@@ -9,18 +9,18 @@
#include "chrome/browser/printing/print_preview_dialog_controller.h"
PrintPreviewContextMenuObserver::PrintPreviewContextMenuObserver(
- content::WebContents* tab) : tab_(tab) {
+ content::WebContents* contents) : contents_(contents) {
}
PrintPreviewContextMenuObserver::~PrintPreviewContextMenuObserver() {
}
-bool PrintPreviewContextMenuObserver::IsPrintPreviewTab() {
+bool PrintPreviewContextMenuObserver::IsPrintPreviewDialog() {
printing::PrintPreviewDialogController* controller =
printing::PrintPreviewDialogController::GetInstance();
if (!controller)
return false;
- return !!controller->GetPrintPreviewForTab(tab_);
+ return (controller->GetPrintPreviewForContents(contents_) != NULL);
}
bool PrintPreviewContextMenuObserver::IsCommandIdSupported(int command_id) {
@@ -30,7 +30,7 @@ bool PrintPreviewContextMenuObserver::IsCommandIdSupported(int command_id) {
case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
- return IsPrintPreviewTab();
+ return IsPrintPreviewDialog();
default:
return false;
diff --git a/chrome/browser/printing/print_preview_context_menu_observer.h b/chrome/browser/printing/print_preview_context_menu_observer.h
index 5fb1860..2afd6b0 100644
--- a/chrome/browser/printing/print_preview_context_menu_observer.h
+++ b/chrome/browser/printing/print_preview_context_menu_observer.h
@@ -15,7 +15,7 @@ class WebContents;
class PrintPreviewContextMenuObserver : public RenderViewContextMenuObserver {
public:
- explicit PrintPreviewContextMenuObserver(content::WebContents* tab);
+ explicit PrintPreviewContextMenuObserver(content::WebContents* contents);
virtual ~PrintPreviewContextMenuObserver();
// RenderViewContextMenuObserver implementation.
@@ -23,9 +23,9 @@ class PrintPreviewContextMenuObserver : public RenderViewContextMenuObserver {
virtual bool IsCommandIdEnabled(int command_id) OVERRIDE;
private:
- bool IsPrintPreviewTab();
+ bool IsPrintPreviewDialog();
- content::WebContents* tab_;
+ content::WebContents* contents_;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewContextMenuObserver);
};
diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc
index c8530e4..53e4adf 100644
--- a/chrome/browser/printing/print_preview_dialog_controller.cc
+++ b/chrome/browser/printing/print_preview_dialog_controller.cc
@@ -204,7 +204,7 @@ namespace printing {
PrintPreviewDialogController::PrintPreviewDialogController()
: waiting_for_new_preview_page_(false),
- is_creating_print_preview_tab_(false) {
+ is_creating_print_preview_dialog_(false) {
}
// static
@@ -245,6 +245,11 @@ WebContents* PrintPreviewDialogController::GetOrCreatePreviewTab(
return preview_tab;
}
+WebContents* PrintPreviewDialogController::GetPrintPreviewForContents(
+ WebContents* contents) const {
+ return GetPrintPreviewForTab(contents);
+}
+
WebContents* PrintPreviewDialogController::GetPrintPreviewForTab(
WebContents* tab) const {
// |preview_tab_map_| is keyed by the preview tab, so if find() succeeds, then
@@ -315,8 +320,8 @@ void PrintPreviewDialogController::EraseInitiatorTabInfo(
preview_tab_map_[preview_tab] = NULL;
}
-bool PrintPreviewDialogController::is_creating_print_preview_tab() const {
- return is_creating_print_preview_tab_;
+bool PrintPreviewDialogController::is_creating_print_preview_dialog() const {
+ return is_creating_print_preview_dialog_;
}
PrintPreviewDialogController::~PrintPreviewDialogController() {}
@@ -406,7 +411,7 @@ void PrintPreviewDialogController::OnNavEntryCommitted(
WebContents* PrintPreviewDialogController::CreatePrintPreviewTab(
WebContents* initiator_tab) {
- base::AutoReset<bool> auto_reset(&is_creating_print_preview_tab_, true);
+ base::AutoReset<bool> auto_reset(&is_creating_print_preview_dialog_, true);
Profile* profile =
Profile::FromBrowserContext(initiator_tab->GetBrowserContext());
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) {
diff --git a/chrome/browser/printing/print_preview_dialog_controller.h b/chrome/browser/printing/print_preview_dialog_controller.h
index c4011dd..f952cef 100644
--- a/chrome/browser/printing/print_preview_dialog_controller.h
+++ b/chrome/browser/printing/print_preview_dialog_controller.h
@@ -57,9 +57,14 @@ class PrintPreviewDialogController
content::WebContents* GetOrCreatePreviewTab(
content::WebContents* initiator_tab);
- // Returns preview tab for |tab|.
- // Returns |tab| if |tab| is a preview tab.
- // Returns NULL if no preview tab exists for |tab|.
+ // Returns the preview dialog for |contents|.
+ // Returns |contents| if |contents| is a preview dialog.
+ // Returns NULL if no preview dialog exists for |contents|.
+ content::WebContents* GetPrintPreviewForContents(
+ content::WebContents* contents) const;
+
+ // DEPRECATED. Use GetPrintPreviewForContents() instead.
+ // TODO(thestig) Remove.
content::WebContents* GetPrintPreviewForTab(content::WebContents* tab) const;
// Returns initiator tab for |preview_tab|.
@@ -84,7 +89,7 @@ class PrintPreviewDialogController
// Erase the initiator tab info associated with |preview_tab|.
void EraseInitiatorTabInfo(content::WebContents* preview_tab);
- bool is_creating_print_preview_tab() const;
+ bool is_creating_print_preview_dialog() const;
private:
friend class base::RefCounted<PrintPreviewDialogController>;
@@ -137,8 +142,8 @@ class PrintPreviewDialogController
bool waiting_for_new_preview_page_;
// Whether the PrintPreviewDialogController is in the middle of creating a
- // print preview tab.
- bool is_creating_print_preview_tab_;
+ // print preview dialog.
+ bool is_creating_print_preview_dialog_;
DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController);
};
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 6e3c4e6..6d89b80 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -102,18 +102,17 @@ bool PrintViewManager::PrintForSystemDialogNow() {
}
bool PrintViewManager::AdvancedPrintNow() {
- PrintPreviewDialogController* tab_controller =
+ PrintPreviewDialogController* dialog_controller =
PrintPreviewDialogController::GetInstance();
- if (!tab_controller)
+ if (!dialog_controller)
return false;
- WebContents* print_preview_tab =
- tab_controller->GetPrintPreviewForTab(web_contents());
- if (print_preview_tab) {
- // Preview tab exist for current tab or current tab is preview tab.
- if (!print_preview_tab->GetWebUI())
+ WebContents* print_preview_dialog =
+ dialog_controller->GetPrintPreviewForContents(web_contents());
+ if (print_preview_dialog) {
+ if (!print_preview_dialog->GetWebUI())
return false;
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
- print_preview_tab->GetWebUI()->GetController());
+ print_preview_dialog->GetWebUI()->GetController());
print_preview_ui->OnShowSystemDialog();
return true;
} else {
@@ -327,9 +326,9 @@ void PrintViewManager::OnScriptedPrintPreview(bool source_is_modifiable,
return;
}
- PrintPreviewDialogController* tab_controller =
+ PrintPreviewDialogController* dialog_controller =
PrintPreviewDialogController::GetInstance();
- if (!tab_controller) {
+ if (!dialog_controller) {
Send(reply_msg);
return;
}
@@ -342,9 +341,9 @@ void PrintViewManager::OnScriptedPrintPreview(bool source_is_modifiable,
map[rph] = callback;
scripted_print_preview_rph_ = rph;
- tab_controller->PrintPreview(web_contents());
+ dialog_controller->PrintPreview(web_contents());
PrintPreviewUI::SetSourceIsModifiable(
- tab_controller->GetPrintPreviewForTab(web_contents()),
+ dialog_controller->GetPrintPreviewForContents(web_contents()),
source_is_modifiable);
}
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index b3b56ee..016eb57 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -47,7 +47,7 @@ class PrintViewManager : public content::NotificationObserver,
// Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to
// show the native system dialog. This can happen from both initiator tab and
- // preview tab.
+ // preview dialog.
bool AdvancedPrintNow();
// Same as PrintNow(), but for the case where we want to send the result to
@@ -56,9 +56,9 @@ class PrintViewManager : public content::NotificationObserver,
bool PrintToDestination();
// Initiate print preview of the current document by first notifying the
- // renderer. Since this happens asynchronous, the print preview tab creation
- // will not be completed on the return of this function. Returns false if
- // print preview is impossible at the moment.
+ // renderer. Since this happens asynchronous, the print preview dialog
+ // creation will not be completed on the return of this function. Returns
+ // false if print preview is impossible at the moment.
bool PrintPreviewNow();
// Notify PrintViewManager that print preview is starting in the renderer for
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 85eb974..da95740 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -191,8 +191,8 @@ bool PrintPreviewShowing(const Browser* browser) {
WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
printing::PrintPreviewDialogController* controller =
printing::PrintPreviewDialogController::GetInstance();
- return controller && (controller->GetPrintPreviewForTab(contents) ||
- controller->is_creating_print_preview_tab());
+ return controller && (controller->GetPrintPreviewForContents(contents) ||
+ controller->is_creating_print_preview_dialog());
}
bool IsNTPModeForInstantExtendedAPI(const Browser* browser) {
diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc
index c5933e7..af2d16b 100644
--- a/chrome/browser/ui/webui/web_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/web_ui_browsertest.cc
@@ -239,10 +239,10 @@ void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) {
printing::PrintPreviewDialogController* tab_controller =
printing::PrintPreviewDialogController::GetInstance();
ASSERT_TRUE(tab_controller);
- WebContents* preview_tab = tab_controller->GetPrintPreviewForTab(
+ WebContents* preview_dialog = tab_controller->GetPrintPreviewForContents(
browser()->tab_strip_model()->GetActiveWebContents());
- ASSERT_TRUE(preview_tab);
- SetWebUIInstance(preview_tab->GetWebUI());
+ ASSERT_TRUE(preview_dialog);
+ SetWebUIInstance(preview_dialog->GetWebUI());
}
const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL";