| 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 <vector> | 10 #include <vector> |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Show a native UI tab given a URL. If a tab with the same URL is already | 223 // Show a native UI tab given a URL. If a tab with the same URL is already |
| 224 // visible in this browser, it becomes selected. Otherwise a new tab is | 224 // visible in this browser, it becomes selected. Otherwise a new tab is |
| 225 // created. | 225 // created. |
| 226 void ShowNativeUITab(const GURL& url); | 226 void ShowNativeUITab(const GURL& url); |
| 227 | 227 |
| 228 // Assorted browser commands //////////////////////////////////////////////// | 228 // Assorted browser commands //////////////////////////////////////////////// |
| 229 | 229 |
| 230 // NOTE: Within each of the following sections, the IDs are ordered roughly by | 230 // NOTE: Within each of the following sections, the IDs are ordered roughly by |
| 231 // how they appear in the GUI/menus (left to right, top to bottom, etc.). | 231 // how they appear in the GUI/menus (left to right, top to bottom, etc.). |
| 232 | 232 |
| 233 #endif |
| 233 // Navigation commands | 234 // Navigation commands |
| 234 void GoBack(); | 235 void GoBack(); |
| 235 void GoForward(); | 236 void GoForward(); |
| 236 void Reload(); | 237 void Reload(); |
| 237 void Home(); | 238 void Home(); |
| 239 #if defined(OS_WIN) |
| 238 void OpenCurrentURL(); | 240 void OpenCurrentURL(); |
| 239 void Go(); | 241 void Go(); |
| 240 void Stop(); | 242 void Stop(); |
| 241 #endif | 243 #endif |
| 242 // Window management commands | 244 // Window management commands |
| 243 void NewWindow(); | 245 void NewWindow(); |
| 244 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
| 245 void NewIncognitoWindow(); | 247 void NewIncognitoWindow(); |
| 246 void NewProfileWindowByIndex(int index); | 248 void NewProfileWindowByIndex(int index); |
| 247 void CloseWindow(); | 249 void CloseWindow(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 virtual int GetDragActions() const; | 337 virtual int GetDragActions() const; |
| 336 // Construct a TabContents for a given URL, profile and transition type. | 338 // Construct a TabContents for a given URL, profile and transition type. |
| 337 // If instance is not null, its process will be used to render the tab. | 339 // If instance is not null, its process will be used to render the tab. |
| 338 virtual TabContents* CreateTabContentsForURL( | 340 virtual TabContents* CreateTabContentsForURL( |
| 339 const GURL& url, | 341 const GURL& url, |
| 340 const GURL& referrer, | 342 const GURL& referrer, |
| 341 Profile* profile, | 343 Profile* profile, |
| 342 PageTransition::Type transition, | 344 PageTransition::Type transition, |
| 343 bool defer_load, | 345 bool defer_load, |
| 344 SiteInstance* instance) const; | 346 SiteInstance* instance) const; |
| 347 #endif |
| 345 virtual bool CanDuplicateContentsAt(int index); | 348 virtual bool CanDuplicateContentsAt(int index); |
| 349 #if defined(OS_WIN) |
| 346 virtual void DuplicateContentsAt(int index); | 350 virtual void DuplicateContentsAt(int index); |
| 347 virtual void CloseFrameAfterDragSession(); | 351 virtual void CloseFrameAfterDragSession(); |
| 348 | 352 |
| 349 // Overridden from TabStripModelObserver: | 353 // Overridden from TabStripModelObserver: |
| 350 virtual void TabInsertedAt(TabContents* contents, | 354 virtual void TabInsertedAt(TabContents* contents, |
| 351 int index, | 355 int index, |
| 352 bool foreground); | 356 bool foreground); |
| 353 virtual void TabClosingAt(TabContents* contents, int index); | 357 virtual void TabClosingAt(TabContents* contents, int index); |
| 354 virtual void TabDetachedAt(TabContents* contents, int index); | 358 virtual void TabDetachedAt(TabContents* contents, int index); |
| 355 virtual void TabSelectedAt(TabContents* old_contents, | 359 virtual void TabSelectedAt(TabContents* old_contents, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 virtual void Observe(NotificationType type, | 409 virtual void Observe(NotificationType type, |
| 406 const NotificationSource& source, | 410 const NotificationSource& source, |
| 407 const NotificationDetails& details); | 411 const NotificationDetails& details); |
| 408 | 412 |
| 409 private: | 413 private: |
| 410 // Command and state updating /////////////////////////////////////////////// | 414 // Command and state updating /////////////////////////////////////////////// |
| 411 | 415 |
| 412 // Initialize state for all browser commands. | 416 // Initialize state for all browser commands. |
| 413 void InitCommandState(); | 417 void InitCommandState(); |
| 414 | 418 |
| 415 #if defined(OS_WIN) | |
| 416 // Update commands which may be enabled or disabled depending on the tab's | 419 // Update commands which may be enabled or disabled depending on the tab's |
| 417 // state. | 420 // state. |
| 418 void UpdateCommandsForTabState(); | 421 void UpdateCommandsForTabState(); |
| 419 | 422 |
| 420 // Set the correct stop/go icon and update the Go and Stop command states. | 423 // Set the correct stop/go icon and update the Go and Stop command states. |
| 421 // |is_loading| is true if the current TabContents is loading. | 424 // |is_loading| is true if the current TabContents is loading. |
| 422 void UpdateStopGoState(bool is_loading); | 425 void UpdateStopGoState(bool is_loading); |
| 423 | 426 |
| 424 // Change the "starred" button display to starred/unstarred. | 427 // Change the "starred" button display to starred/unstarred. |
| 425 // TODO(evanm): migrate this to the commands framework. | 428 // TODO(evanm): migrate this to the commands framework. |
| 426 void SetStarredButtonToggled(bool starred); | 429 void SetStarredButtonToggled(bool starred); |
| 427 | 430 |
| 431 #if defined(OS_WIN) |
| 428 // UI update coalescing and handling //////////////////////////////////////// | 432 // UI update coalescing and handling //////////////////////////////////////// |
| 429 | 433 |
| 430 // Asks the toolbar (and as such the location bar) to update its state to | 434 // Asks the toolbar (and as such the location bar) to update its state to |
| 431 // reflect the current tab's current URL, security state, etc. | 435 // reflect the current tab's current URL, security state, etc. |
| 432 // If |should_restore_state| is true, we're switching (back?) to this tab and | 436 // If |should_restore_state| is true, we're switching (back?) to this tab and |
| 433 // should restore any previous location bar state (such as user editing) as | 437 // should restore any previous location bar state (such as user editing) as |
| 434 // well. | 438 // well. |
| 435 void UpdateToolbar(bool should_restore_state); | 439 void UpdateToolbar(bool should_restore_state); |
| 436 | 440 |
| 437 // Adds an update to the update queue and schedules an update if necessary. | 441 // Adds an update to the update queue and schedules an update if necessary. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 448 | 452 |
| 449 // Getters for UI /////////////////////////////////////////////////////////// | 453 // Getters for UI /////////////////////////////////////////////////////////// |
| 450 | 454 |
| 451 // TODO(beng): remove, and provide AutomationProvider a better way to access | 455 // TODO(beng): remove, and provide AutomationProvider a better way to access |
| 452 // the LocationBarView's edit. | 456 // the LocationBarView's edit. |
| 453 friend class AutomationProvider; | 457 friend class AutomationProvider; |
| 454 | 458 |
| 455 // Getters for the location bar and go button. | 459 // Getters for the location bar and go button. |
| 456 #endif // OS_WIN | 460 #endif // OS_WIN |
| 457 LocationBarView* GetLocationBarView() const; | 461 LocationBarView* GetLocationBarView() const; |
| 458 #if defined(OS_WIN) | |
| 459 GoButton* GetGoButton(); | 462 GoButton* GetGoButton(); |
| 460 | 463 |
| 461 // Returns the StatusBubble from the current toolbar. It is possible for | 464 // Returns the StatusBubble from the current toolbar. It is possible for |
| 462 // this to return NULL if called before the toolbar has initialized. | 465 // this to return NULL if called before the toolbar has initialized. |
| 463 // TODO(beng): remove this. | 466 // TODO(beng): remove this. |
| 464 StatusBubble* GetStatusBubble(); | 467 StatusBubble* GetStatusBubble(); |
| 465 | 468 |
| 469 #if defined(OS_WIN) |
| 466 // Session restore functions //////////////////////////////////////////////// | 470 // Session restore functions //////////////////////////////////////////////// |
| 467 | 471 |
| 468 // Notifies the history database of the index for all tabs whose index is | 472 // Notifies the history database of the index for all tabs whose index is |
| 469 // >= index. | 473 // >= index. |
| 470 void SyncHistoryWithTabs(int index); | 474 void SyncHistoryWithTabs(int index); |
| 471 | 475 |
| 472 // Called from AddRestoredTab and ReplaceRestoredTab to build a | 476 // Called from AddRestoredTab and ReplaceRestoredTab to build a |
| 473 // NavigationController from an incoming vector of TabNavigations. | 477 // NavigationController from an incoming vector of TabNavigations. |
| 474 // Caller takes ownership of the returned NavigationController. | 478 // Caller takes ownership of the returned NavigationController. |
| 475 NavigationController* BuildRestoredNavigationController( | 479 NavigationController* BuildRestoredNavigationController( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // Retrieve the last active tabbed browser with the same profile as the | 512 // Retrieve the last active tabbed browser with the same profile as the |
| 509 // receiving Browser. Creates a new Browser if none are available. | 513 // receiving Browser. Creates a new Browser if none are available. |
| 510 Browser* GetOrCreateTabbedBrowser(); | 514 Browser* GetOrCreateTabbedBrowser(); |
| 511 | 515 |
| 512 // Creates a new popup window with its own Browser object with the | 516 // Creates a new popup window with its own Browser object with the |
| 513 // incoming sizing information. |initial_pos|'s origin() is the | 517 // incoming sizing information. |initial_pos|'s origin() is the |
| 514 // window origin, and its size() is the size of the content area. | 518 // window origin, and its size() is the size of the content area. |
| 515 void BuildPopupWindow(TabContents* source, | 519 void BuildPopupWindow(TabContents* source, |
| 516 TabContents* new_contents, | 520 TabContents* new_contents, |
| 517 const gfx::Rect& initial_pos); | 521 const gfx::Rect& initial_pos); |
| 522 #endif |
| 518 | 523 |
| 519 // Returns what the user's home page is, or the new tab page if the home page | 524 // Returns what the user's home page is, or the new tab page if the home page |
| 520 // has not been set. | 525 // has not been set. |
| 521 GURL GetHomePage(); | 526 GURL GetHomePage(); |
| 522 | 527 |
| 528 #if defined(OS_WIN) |
| 523 // Advance the find selection by one. Direction is either forward or | 529 // Advance the find selection by one. Direction is either forward or |
| 524 // backwards depending on parameter passed in. | 530 // backwards depending on parameter passed in. |
| 525 void AdvanceFindSelection(bool forward_direction); | 531 void AdvanceFindSelection(bool forward_direction); |
| 526 | 532 |
| 527 // Closes the frame. | 533 // Closes the frame. |
| 528 // TODO(beng): figure out if we need this now that the frame itself closes | 534 // TODO(beng): figure out if we need this now that the frame itself closes |
| 529 // after a return to the message loop. | 535 // after a return to the message loop. |
| 530 void CloseFrame(); | 536 void CloseFrame(); |
| 531 | 537 |
| 532 // Compute a deterministic name based on the URL. We use this pseudo name | 538 // Compute a deterministic name based on the URL. We use this pseudo name |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 // The browser idle task helps cleanup unused memory resources when idle. | 646 // The browser idle task helps cleanup unused memory resources when idle. |
| 641 scoped_ptr<BrowserIdleTimer> idle_task_; | 647 scoped_ptr<BrowserIdleTimer> idle_task_; |
| 642 | 648 |
| 643 // Keep track of the encoding auto detect pref. | 649 // Keep track of the encoding auto detect pref. |
| 644 BooleanPrefMember encoding_auto_detect_; | 650 BooleanPrefMember encoding_auto_detect_; |
| 645 | 651 |
| 646 DISALLOW_COPY_AND_ASSIGN(Browser); | 652 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 647 }; | 653 }; |
| 648 | 654 |
| 649 #endif // CHROME_BROWSER_BROWSER_H_ | 655 #endif // CHROME_BROWSER_BROWSER_H_ |
| OLD | NEW |