OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_TABS_TAB_STRIP_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 void SetTabBlocked(int index, bool blocked); | 318 void SetTabBlocked(int index, bool blocked); |
319 | 319 |
320 // Changes the pinned state of the tab at |index|. See description above | 320 // Changes the pinned state of the tab at |index|. See description above |
321 // class for details on this. | 321 // class for details on this. |
322 void SetTabPinned(int index, bool pinned); | 322 void SetTabPinned(int index, bool pinned); |
323 | 323 |
324 // Returns true if the tab at |index| is pinned. | 324 // Returns true if the tab at |index| is pinned. |
325 // See description above class for details on pinned tabs. | 325 // See description above class for details on pinned tabs. |
326 bool IsTabPinned(int index) const; | 326 bool IsTabPinned(int index) const; |
327 | 327 |
| 328 // Changes the muted audio state of the tab at |index|. |
| 329 void SetTabAudioMuted(int index, bool mute); |
| 330 |
| 331 // Returns true if the tab at |index| is muting its audio. |
| 332 bool IsTabAudioMuted(int index) const; |
| 333 |
328 // Is the tab a mini-tab? | 334 // Is the tab a mini-tab? |
329 // See description above class for details on this. | 335 // See description above class for details on this. |
330 bool IsMiniTab(int index) const; | 336 bool IsMiniTab(int index) const; |
331 | 337 |
332 // Is the tab at |index| an app? | 338 // Is the tab at |index| an app? |
333 // See description above class for details on app tabs. | 339 // See description above class for details on app tabs. |
334 bool IsAppTab(int index) const; | 340 bool IsAppTab(int index) const; |
335 | 341 |
336 // Returns true if the tab at |index| is blocked by a tab modal dialog. | 342 // Returns true if the tab at |index| is blocked by a tab modal dialog. |
337 bool IsTabBlocked(int index) const; | 343 bool IsTabBlocked(int index) const; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 enum ContextMenuCommand { | 411 enum ContextMenuCommand { |
406 CommandFirst = 0, | 412 CommandFirst = 0, |
407 CommandNewTab, | 413 CommandNewTab, |
408 CommandReload, | 414 CommandReload, |
409 CommandDuplicate, | 415 CommandDuplicate, |
410 CommandCloseTab, | 416 CommandCloseTab, |
411 CommandCloseOtherTabs, | 417 CommandCloseOtherTabs, |
412 CommandCloseTabsToRight, | 418 CommandCloseTabsToRight, |
413 CommandRestoreTab, | 419 CommandRestoreTab, |
414 CommandTogglePinned, | 420 CommandTogglePinned, |
| 421 CommandToggleTabAudioMuted, |
415 CommandBookmarkAllTabs, | 422 CommandBookmarkAllTabs, |
416 CommandSelectByDomain, | 423 CommandSelectByDomain, |
417 CommandSelectByOpener, | 424 CommandSelectByOpener, |
418 CommandLast | 425 CommandLast |
419 }; | 426 }; |
420 | 427 |
421 // Returns true if the specified command is enabled. If |context_index| is | 428 // Returns true if the specified command is enabled. If |context_index| is |
422 // selected the response applies to all selected tabs. | 429 // selected the response applies to all selected tabs. |
423 bool IsContextMenuCommandEnabled(int context_index, | 430 bool IsContextMenuCommandEnabled(int context_index, |
424 ContextMenuCommand command_id) const; | 431 ContextMenuCommand command_id) const; |
425 | 432 |
426 // Performs the action associated with the specified command for the given | 433 // Performs the action associated with the specified command for the given |
427 // TabStripModel index |context_index|. If |context_index| is selected the | 434 // TabStripModel index |context_index|. If |context_index| is selected the |
428 // command applies to all selected tabs. | 435 // command applies to all selected tabs. |
429 void ExecuteContextMenuCommand(int context_index, | 436 void ExecuteContextMenuCommand(int context_index, |
430 ContextMenuCommand command_id); | 437 ContextMenuCommand command_id); |
431 | 438 |
432 // Returns a vector of indices of the tabs that will close when executing the | 439 // Returns a vector of indices of the tabs that will close when executing the |
433 // command |id| for the tab at |index|. The returned indices are sorted in | 440 // command |id| for the tab at |index|. The returned indices are sorted in |
434 // descending order. | 441 // descending order. |
435 std::vector<int> GetIndicesClosedByCommand(int index, | 442 std::vector<int> GetIndicesClosedByCommand(int index, |
436 ContextMenuCommand id) const; | 443 ContextMenuCommand id) const; |
437 | 444 |
438 // Returns true if 'CommandTogglePinned' will pin. |index| is the index | 445 // Returns true if 'CommandTogglePinned' will pin. |index| is the index |
439 // supplied to |ExecuteContextMenuCommand|. | 446 // supplied to |ExecuteContextMenuCommand|. |
440 bool WillContextMenuPin(int index); | 447 bool WillContextMenuPin(int index); |
441 | 448 |
| 449 // Returns true if 'CommandToggleTabAudioMuted' will mute. |index| is the |
| 450 // index supplied to |ExecuteContextMenuCommand|. |
| 451 bool WillContextMenuMute(int index); |
| 452 |
442 // Convert a ContextMenuCommand into a browser command. Returns true if a | 453 // Convert a ContextMenuCommand into a browser command. Returns true if a |
443 // corresponding browser command exists, false otherwise. | 454 // corresponding browser command exists, false otherwise. |
444 static bool ContextMenuCommandToBrowserCommand(int cmd_id, int* browser_cmd); | 455 static bool ContextMenuCommandToBrowserCommand(int cmd_id, int* browser_cmd); |
445 | 456 |
446 private: | 457 private: |
447 class WebContentsData; | 458 class WebContentsData; |
448 | 459 |
449 // Used when making selection notifications. | 460 // Used when making selection notifications. |
450 enum NotifyTypes { | 461 enum NotifyTypes { |
451 NOTIFY_DEFAULT, | 462 NOTIFY_DEFAULT, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 586 |
576 // TODO(sky): remove this; used for debugging 291265. | 587 // TODO(sky): remove this; used for debugging 291265. |
577 bool in_notify_; | 588 bool in_notify_; |
578 | 589 |
579 base::WeakPtrFactory<TabStripModel> weak_factory_; | 590 base::WeakPtrFactory<TabStripModel> weak_factory_; |
580 | 591 |
581 DISALLOW_IMPLICIT_CONSTRUCTORS(TabStripModel); | 592 DISALLOW_IMPLICIT_CONSTRUCTORS(TabStripModel); |
582 }; | 593 }; |
583 | 594 |
584 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_H_ | 595 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_H_ |
OLD | NEW |