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

Side by Side Diff: content/browser/tab_contents/tab_contents.h

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Redirect "http://mock.testfile.http/<random path>" to "chrome/test/data/a.htm" Created 9 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) 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 393 }
394 394
395 // Misc state & callbacks ---------------------------------------------------- 395 // Misc state & callbacks ----------------------------------------------------
396 396
397 // Prepare for saving the current web page to disk. 397 // Prepare for saving the current web page to disk.
398 void OnSavePage(); 398 void OnSavePage();
399 399
400 // Save page with the main HTML file path, the directory for saving resources, 400 // Save page with the main HTML file path, the directory for saving resources,
401 // and the save type: HTML only or complete web page. Returns true if the 401 // and the save type: HTML only or complete web page. Returns true if the
402 // saving process has been initiated successfully. 402 // saving process has been initiated successfully.
403 // This method is used in automated testing to bypass prompting the user for
404 // file names. Instead, the names and paths are hard coded rather than
405 // running them through file name sanitation and extension / mime checking.
403 bool SavePage(const FilePath& main_file, const FilePath& dir_path, 406 bool SavePage(const FilePath& main_file, const FilePath& dir_path,
404 SavePackage::SavePackageType save_type); 407 SavePackage::SavePackageType save_type);
405 408
406 // Prepare for saving the URL to disk. 409 // Prepare for saving the URL to disk.
407 // URL may refer to the iframe on the page. 410 // URL may refer to the iframe on the page.
408 void OnSaveURL(const GURL& url); 411 void OnSaveURL(const GURL& url);
409 412
410 // Returns true if the active NavigationEntry's page_id equals page_id. 413 // Returns true if the active NavigationEntry's page_id equals page_id.
411 bool IsActiveEntry(int32 page_id); 414 bool IsActiveEntry(int32 page_id);
412 415
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // automation purposes. 518 // automation purposes.
516 friend class TestingAutomationProvider; 519 friend class TestingAutomationProvider;
517 520
518 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); 521 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials);
519 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); 522 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle);
520 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, CrossSiteCantPreemptAfterUnload); 523 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, CrossSiteCantPreemptAfterUnload);
521 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, ConstrainedWindows); 524 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, ConstrainedWindows);
522 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); 525 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
523 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); 526 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
524 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); 527 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
528 FRIEND_TEST_ALL_PREFIXES(SavePageBrowserTest, SaveFolder1);
529 FRIEND_TEST_ALL_PREFIXES(SavePageBrowserTest, SaveFolder2);
530 FRIEND_TEST_ALL_PREFIXES(SavePageBrowserTest, SaveFolder3);
525 531
526 // Temporary until the view/contents separation is complete. 532 // Temporary until the view/contents separation is complete.
527 friend class TabContentsView; 533 friend class TabContentsView;
528 #if defined(TOOLKIT_VIEWS) 534 #if defined(TOOLKIT_VIEWS)
529 friend class TabContentsViewViews; 535 friend class TabContentsViewViews;
530 #elif defined(OS_MACOSX) 536 #elif defined(OS_MACOSX)
531 friend class TabContentsViewMac; 537 friend class TabContentsViewMac;
532 #elif defined(TOOLKIT_USES_GTK) 538 #elif defined(TOOLKIT_USES_GTK)
533 friend class TabContentsViewGtk; 539 friend class TabContentsViewGtk;
534 #endif 540 #endif
535 541
542 // Used in automated testing to bypass prompting the user for file names.
543 // The difference between SavePageBasedOnDefaultPrefs() and SavePage()
544 // is whether the default folder prefs are used. In case of SavePage(),
545 // we need to give it the file path to which the file is saved.
546 // On the other hand, in case of SavePageBasedOnDefaultPrefs(),
547 // we need not to give the file path since the file path is determined
548 // based on the default folder prefs. This method returns the title
549 // of the current tab.
550 string16 SavePageBasedOnDefaultPrefs();
551
536 // So InterstitialPage can access SetIsLoading. 552 // So InterstitialPage can access SetIsLoading.
537 friend class InterstitialPage; 553 friend class InterstitialPage;
538 554
539 // TODO(brettw) TestTabContents shouldn't exist! 555 // TODO(brettw) TestTabContents shouldn't exist!
540 friend class TestTabContents; 556 friend class TestTabContents;
541 557
542 // Message handlers. 558 // Message handlers.
543 void OnDidStartProvisionalLoadForFrame(int64 frame_id, 559 void OnDidStartProvisionalLoadForFrame(int64 frame_id,
544 bool main_frame, 560 bool main_frame,
545 bool has_opener_set, 561 bool has_opener_set,
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 ObserverList<TabContentsObserver> observers_; 874 ObserverList<TabContentsObserver> observers_;
859 875
860 // Content restrictions, used to disable print/copy etc based on content's 876 // Content restrictions, used to disable print/copy etc based on content's
861 // (full-page plugins for now only) permissions. 877 // (full-page plugins for now only) permissions.
862 int content_restrictions_; 878 int content_restrictions_;
863 879
864 DISALLOW_COPY_AND_ASSIGN(TabContents); 880 DISALLOW_COPY_AND_ASSIGN(TabContents);
865 }; 881 };
866 882
867 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 883 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698