OLD | NEW |
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 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 390 } |
391 | 391 |
392 // Misc state & callbacks ---------------------------------------------------- | 392 // Misc state & callbacks ---------------------------------------------------- |
393 | 393 |
394 // Prepare for saving the current web page to disk. | 394 // Prepare for saving the current web page to disk. |
395 void OnSavePage(); | 395 void OnSavePage(); |
396 | 396 |
397 // Save page with the main HTML file path, the directory for saving resources, | 397 // Save page with the main HTML file path, the directory for saving resources, |
398 // and the save type: HTML only or complete web page. Returns true if the | 398 // and the save type: HTML only or complete web page. Returns true if the |
399 // saving process has been initiated successfully. | 399 // saving process has been initiated successfully. |
| 400 // This method is used in automated testing to bypass prompting the user for |
| 401 // file names. Instead, the names and paths are hard coded rather than |
| 402 // running them through file name sanitation and extension / mime checking. |
400 bool SavePage(const FilePath& main_file, const FilePath& dir_path, | 403 bool SavePage(const FilePath& main_file, const FilePath& dir_path, |
401 SavePackage::SavePackageType save_type); | 404 SavePackage::SavePackageType save_type); |
402 | 405 |
403 // Prepare for saving the URL to disk. | 406 // Prepare for saving the URL to disk. |
404 // URL may refer to the iframe on the page. | 407 // URL may refer to the iframe on the page. |
405 void OnSaveURL(const GURL& url); | 408 void OnSaveURL(const GURL& url); |
406 | 409 |
407 // Returns true if the active NavigationEntry's page_id equals page_id. | 410 // Returns true if the active NavigationEntry's page_id equals page_id. |
408 bool IsActiveEntry(int32 page_id); | 411 bool IsActiveEntry(int32 page_id); |
409 | 412 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // automation purposes. | 515 // automation purposes. |
513 friend class TestingAutomationProvider; | 516 friend class TestingAutomationProvider; |
514 | 517 |
515 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); | 518 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); |
516 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); | 519 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); |
517 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, CrossSiteCantPreemptAfterUnload); | 520 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, CrossSiteCantPreemptAfterUnload); |
518 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, ConstrainedWindows); | 521 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, ConstrainedWindows); |
519 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); | 522 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
520 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); | 523 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
521 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); | 524 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); |
| 525 FRIEND_TEST_ALL_PREFIXES(SavePageBrowserTest, SaveFolder1); |
| 526 FRIEND_TEST_ALL_PREFIXES(SavePageBrowserTest, SaveFolder2); |
| 527 FRIEND_TEST_ALL_PREFIXES(SavePageBrowserTest, SaveFolder3); |
522 | 528 |
523 // Temporary until the view/contents separation is complete. | 529 // Temporary until the view/contents separation is complete. |
524 friend class TabContentsView; | 530 friend class TabContentsView; |
525 #if defined(TOOLKIT_VIEWS) | 531 #if defined(TOOLKIT_VIEWS) |
526 friend class TabContentsViewViews; | 532 friend class TabContentsViewViews; |
527 #elif defined(OS_MACOSX) | 533 #elif defined(OS_MACOSX) |
528 friend class TabContentsViewMac; | 534 friend class TabContentsViewMac; |
529 #elif defined(TOOLKIT_USES_GTK) | 535 #elif defined(TOOLKIT_USES_GTK) |
530 friend class TabContentsViewGtk; | 536 friend class TabContentsViewGtk; |
531 #endif | 537 #endif |
532 | 538 |
| 539 // Used in automated testing to bypass prompting the user for file names. |
| 540 // The difference between SavePageBasedOnDefaultPrefs() and SavePage() |
| 541 // is whether the default folder prefs are used. In case of SavePage(), |
| 542 // we need to give it the file path to which the file is saved. |
| 543 // On the other hand, in case of SavePageBasedOnDefaultPrefs(), |
| 544 // we need not to give the file path since the file path is determined |
| 545 // based on the default folder prefs. This method returns the title |
| 546 // of the current tab. |
| 547 string16 SavePageBasedOnDefaultPrefs(); |
| 548 |
533 // So InterstitialPage can access SetIsLoading. | 549 // So InterstitialPage can access SetIsLoading. |
534 friend class InterstitialPage; | 550 friend class InterstitialPage; |
535 | 551 |
536 // TODO(brettw) TestTabContents shouldn't exist! | 552 // TODO(brettw) TestTabContents shouldn't exist! |
537 friend class TestTabContents; | 553 friend class TestTabContents; |
538 | 554 |
539 // Message handlers. | 555 // Message handlers. |
540 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 556 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
541 bool main_frame, | 557 bool main_frame, |
542 bool has_opener_set, | 558 bool has_opener_set, |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 ObserverList<TabContentsObserver> observers_; | 868 ObserverList<TabContentsObserver> observers_; |
853 | 869 |
854 // Content restrictions, used to disable print/copy etc based on content's | 870 // Content restrictions, used to disable print/copy etc based on content's |
855 // (full-page plugins for now only) permissions. | 871 // (full-page plugins for now only) permissions. |
856 int content_restrictions_; | 872 int content_restrictions_; |
857 | 873 |
858 DISALLOW_COPY_AND_ASSIGN(TabContents); | 874 DISALLOW_COPY_AND_ASSIGN(TabContents); |
859 }; | 875 }; |
860 | 876 |
861 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 877 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |