OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_H_ |
6 #define CHROME_BROWSER_BROWSER_H_ | 6 #define CHROME_BROWSER_BROWSER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 class BrowserIdleTimer; | 36 class BrowserIdleTimer; |
37 class BrowserWindow; | 37 class BrowserWindow; |
38 class DebuggerWindow; | 38 class DebuggerWindow; |
39 class GoButton; | 39 class GoButton; |
40 class LocationBar; | 40 class LocationBar; |
41 class PrefService; | 41 class PrefService; |
42 class Profile; | 42 class Profile; |
43 class StatusBubble; | 43 class StatusBubble; |
44 class TabNavigation; | 44 class TabNavigation; |
45 class WebApp; | |
46 | 45 |
47 class Browser : public TabStripModelDelegate, | 46 class Browser : public TabStripModelDelegate, |
48 public TabStripModelObserver, | 47 public TabStripModelObserver, |
49 public TabContentsDelegate, | 48 public TabContentsDelegate, |
50 public CommandUpdater::CommandUpdaterDelegate, | 49 public CommandUpdater::CommandUpdaterDelegate, |
51 public NotificationObserver, | 50 public NotificationObserver, |
52 public SelectFileDialog::Listener { | 51 public SelectFileDialog::Listener { |
53 public: | 52 public: |
54 enum Type { | 53 enum Type { |
55 TYPE_NORMAL = 0, | 54 TYPE_NORMAL = 0, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Browser Creation Helpers ///////////////////////////////////////////////// | 116 // Browser Creation Helpers ///////////////////////////////////////////////// |
118 | 117 |
119 // Opens a new window with the default blank tab. | 118 // Opens a new window with the default blank tab. |
120 static void OpenEmptyWindow(Profile* profile); | 119 static void OpenEmptyWindow(Profile* profile); |
121 | 120 |
122 // Opens the specified URL in a new browser window in an incognito session. | 121 // Opens the specified URL in a new browser window in an incognito session. |
123 // If there is already an existing active incognito session for the specified | 122 // If there is already an existing active incognito session for the specified |
124 // |profile|, that session is re-used. | 123 // |profile|, that session is re-used. |
125 static void OpenURLOffTheRecord(Profile* profile, const GURL& url); | 124 static void OpenURLOffTheRecord(Profile* profile, const GURL& url); |
126 | 125 |
127 // Opens the a new application window for the specified WebApp. | 126 // Opens the a new application ("thin frame") window for the specified url. |
128 static void OpenWebApplication(Profile* profile, WebApp* app); | 127 static void OpenApplicationWindow(Profile* profile, const GURL& url); |
129 | 128 |
130 // State Storage and Retrieval for UI /////////////////////////////////////// | 129 // State Storage and Retrieval for UI /////////////////////////////////////// |
131 | 130 |
132 // Save and restore the window position. | 131 // Save and restore the window position. |
133 std::wstring GetWindowPlacementKey() const; | 132 std::wstring GetWindowPlacementKey() const; |
134 bool ShouldSaveWindowPlacement() const; | 133 bool ShouldSaveWindowPlacement() const; |
135 void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); | 134 void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); |
136 gfx::Rect GetSavedWindowBounds() const; | 135 gfx::Rect GetSavedWindowBounds() const; |
137 bool GetSavedMaximizedState() const; | 136 bool GetSavedMaximizedState() const; |
138 | 137 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 184 |
186 // Tab adding/showing functions ///////////////////////////////////////////// | 185 // Tab adding/showing functions ///////////////////////////////////////////// |
187 | 186 |
188 // Add a new tab with the specified URL. If instance is not null, its process | 187 // Add a new tab with the specified URL. If instance is not null, its process |
189 // will be used to render the tab. | 188 // will be used to render the tab. |
190 TabContents* AddTabWithURL( | 189 TabContents* AddTabWithURL( |
191 const GURL& url, const GURL& referrer, | 190 const GURL& url, const GURL& referrer, |
192 PageTransition::Type transition, bool foreground, | 191 PageTransition::Type transition, bool foreground, |
193 SiteInstance* instance); | 192 SiteInstance* instance); |
194 | 193 |
195 // Add a new application tab for the specified URL. If lazy is true, the tab | |
196 // won't be selected. Further, the initial web page load will only take place | |
197 // when the tab is first selected. | |
198 TabContents* AddWebApplicationTab(Profile* profile, | |
199 WebApp* web_app, | |
200 bool lazy); | |
201 | |
202 // Add a new tab, given a NavigationController. A TabContents appropriate to | 194 // Add a new tab, given a NavigationController. A TabContents appropriate to |
203 // display the last committed entry is created and returned. | 195 // display the last committed entry is created and returned. |
204 TabContents* AddTabWithNavigationController(NavigationController* ctrl, | 196 TabContents* AddTabWithNavigationController(NavigationController* ctrl, |
205 PageTransition::Type type); | 197 PageTransition::Type type); |
206 | 198 |
207 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
208 // Add a tab with its session history restored from the SessionRestore | 200 // Add a tab with its session history restored from the SessionRestore |
209 // system. If select is true, the tab is selected. Returns the created | 201 // system. If select is true, the tab is selected. Returns the created |
210 // NavigationController. |tab_index| gives the index to insert the tab at. | 202 // NavigationController. |tab_index| gives the index to insert the tab at. |
211 // |selected_navigation| is the index of the TabNavigation in |navigations| | 203 // |selected_navigation| is the index of the TabNavigation in |navigations| |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 #if defined(OS_WIN) | 522 #if defined(OS_WIN) |
531 // Advance the find selection by one. Direction is either forward or | 523 // Advance the find selection by one. Direction is either forward or |
532 // backwards depending on parameter passed in. | 524 // backwards depending on parameter passed in. |
533 void AdvanceFindSelection(bool forward_direction); | 525 void AdvanceFindSelection(bool forward_direction); |
534 | 526 |
535 // Closes the frame. | 527 // Closes the frame. |
536 // TODO(beng): figure out if we need this now that the frame itself closes | 528 // TODO(beng): figure out if we need this now that the frame itself closes |
537 // after a return to the message loop. | 529 // after a return to the message loop. |
538 void CloseFrame(); | 530 void CloseFrame(); |
539 | 531 |
| 532 #endif // OS_WIN |
| 533 |
540 // Compute a deterministic name based on the URL. We use this pseudo name | 534 // Compute a deterministic name based on the URL. We use this pseudo name |
541 // as a key to store window location per application URLs. | 535 // as a key to store window location per application URLs. |
542 static std::wstring ComputeApplicationNameFromURL(const GURL& url); | 536 static std::wstring ComputeApplicationNameFromURL(const GURL& url); |
543 | 537 |
544 // Create a preference dictionary for the provided application name. This is | 538 // Create a preference dictionary for the provided application name. This is |
545 // done only once per application name / per session. | 539 // done only once per application name / per session. |
546 static void RegisterAppPrefs(const std::wstring& app_name); | 540 static void RegisterAppPrefs(const std::wstring& app_name); |
547 | 541 |
548 #endif // OS_WIN | |
549 | |
550 // Data members ///////////////////////////////////////////////////////////// | 542 // Data members ///////////////////////////////////////////////////////////// |
551 | 543 |
552 // This Browser's type. | 544 // This Browser's type. |
553 Type type_; | 545 Type type_; |
554 | 546 |
555 // This Browser's profile. | 547 // This Browser's profile. |
556 Profile* profile_; | 548 Profile* profile_; |
557 | 549 |
558 // This Browser's window. | 550 // This Browser's window. |
559 BrowserWindow* window_; | 551 BrowserWindow* window_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // The browser idle task helps cleanup unused memory resources when idle. | 640 // The browser idle task helps cleanup unused memory resources when idle. |
649 scoped_ptr<BrowserIdleTimer> idle_task_; | 641 scoped_ptr<BrowserIdleTimer> idle_task_; |
650 | 642 |
651 // Keep track of the encoding auto detect pref. | 643 // Keep track of the encoding auto detect pref. |
652 BooleanPrefMember encoding_auto_detect_; | 644 BooleanPrefMember encoding_auto_detect_; |
653 | 645 |
654 DISALLOW_COPY_AND_ASSIGN(Browser); | 646 DISALLOW_COPY_AND_ASSIGN(Browser); |
655 }; | 647 }; |
656 | 648 |
657 #endif // CHROME_BROWSER_BROWSER_H_ | 649 #endif // CHROME_BROWSER_BROWSER_H_ |
OLD | NEW |